Questions tagged [mvvm]

The Model View ViewModel (MVVM) is an architectural pattern used in software engineering that originated from Microsoft as a specialization of the presentation model design pattern introduced by Martin Fowler.

Filter by
Sorted by
Tagged with
0
votes
1answer
29 views

Does default deleting behavior of Datagrid violate mvvm pattern and separation of concerns

In WPF when Datagrid's CanUserDeleteRows property is set to true, then conveniently I don't need to implement deletion of elements from an underlying data structure. But it does mean that deletion ...
0
votes
1answer
33 views

MVVM List<T> from Model to View

I am writing a control app for a 6-DOF robot. This app can send scripts to the robot, which in turn executes these and thus moves around. In the app a robotprogram can be created by adding 3D ...
1
vote
1answer
112 views

The right place for “app logic” in MVVM context

I hope this is the right place to ask. I'm an experienced developer, and have used MVC for much time. This question is in the context of iOS/macOS development for the most part, (SwiftUI). Using MVC ...
1
vote
2answers
256 views

How are changes propagated from the ViewModel to the Model and how often in MVVM?

I am learning the MVVM paradigm and I have seen a few different implementations surrounding the Model and how it is updated which I want to understand. My understanding of the View and ViewModel ...
0
votes
0answers
98 views

Best practices for viewmodels for SwiftUI preview?

Are there best practices about how to prepare lightweight viewmodels with dummy data, that could be used in SwiftUI previews? Right now, I have a viewmodel for an in-app purchase screen, that needs to ...
0
votes
1answer
79 views

How to boost reusability and extendability in a MVVM .Net application?

I'm a software engineer that primarily writes C code but now and then makes .Net applications for fun. This is a question about the fun part. Over a duration of about 15 years, I have used and ...
0
votes
1answer
61 views

How can i handle many children viewmodels in MVVM?

Let's suppose i have a viemwodel which requires a lot of different children viewmodels. An example could be a settings menu: the main viewmodel should be able to load large number of children ...
0
votes
0answers
48 views

In what layer should API be called in Clean Architecture - in Repository or in Use Case?

I am trying to implement Clean Architecture on my Android App with standard MVVM components. Almost every example I have found deals with simple business logic, i.e. simple CRUD operations over data ...
-2
votes
1answer
54 views

WPF MVVM using TPL - should I handle exceptions in the back or front end?

I have a WPF MVVM application, the WPF is the UI frontend and I have another project in the same solution that does DB access, I do this by starting a Task from the frontend that executes the backend ...
1
vote
0answers
40 views

Should all interactions go to ViewModel?

So basically I guess I know the role of MVVM, but correct me if I am wrong View: Basically it whats the users sees + it takes user interaction Also View: It shouldn't know what the model is ... but it ...
-1
votes
1answer
358 views

MVVMCross multiple ViewModels and Views per Window

I may not being fully understanding MVVM or how MVVMCross works, but my understanding of views is that they are components of a window rather than the window itself. When you start up MVVMCross in C# ...
1
vote
2answers
347 views

What is the proper way to handle with View and ViewModel in WPF?

Currently, I'm making an Editor with MVVM pattern in WPF. Editor simply take an instance of a specific type as a reference and modifies it. The following code is the expected usage when editor ...
2
votes
1answer
128 views

Does passing a view model down to a properties violate MVVM or OOP?

I'm new to MVVM but experienced in OOP. I have an easy solution to my problem, but I'm not sure if it violates MVVM or OOP or if it is a good practice. I have a set of ViewModel classes in my WPF ...
0
votes
1answer
608 views

Extract Exception handling MVVM

I noticed a pattern in my code, where im repeating a solid amount of code. Let's say my application has 2 layers. UI and Services. I have a FileService class, that has a CopyTo method. Now there are 2 ...
0
votes
1answer
144 views

How do I plan my refactor of my android app for better architecture?

The current structure of my app is as follows: One activity and multiple fragments (about 25 fragments) One huge monolithic repository One huge monolithic viewmodel Databinding is being used but with ...
1
vote
0answers
472 views

Common business logic in android MVVM

Requirement I am currently working on an android application that uses MVVM, live data and databinding. I have a use-case where I need to show a Comment button in multiple screens in my android app. ...
0
votes
0answers
109 views

WPF MVVM EventAggregator Cons?

We have a wpf mvvm application with a lot of "panes". Just like the draggable panes in visual studio for example. All of these are individual usercontrols with their own viewmodels and im trying to ...
-4
votes
2answers
81 views

MVVM construction questions

I am trying to understand how MVVM works. Here are two examples (in Andrdoid) on how I understand it should work, please tell me if I understood correctly. I currently want to make a list of ...
0
votes
2answers
61 views

Should a view-model be coupled to a view or to a model?

That is, let's say I have a model that's used in several views. Should I create a single view model to represent it across all those views, or should I create a separate view model for each view that ...
5
votes
5answers
4k views

WPF UserControl Reuse With MVVM

I'm struggling to find an elegant and idiomatic way of coding the following scenario using the MVVM paradigm in WPF and was wondering how other people would approach it. I have a UserControl in my ...
0
votes
2answers
250 views

Dependency relations in MVVM and the place of the controller

I know there is plenty of questions about this, but there is a lot of seemingly conflicting information. My assumption: The viewmodel is an abstraction of the view, an interface to the business ...
0
votes
1answer
123 views

CRUD actions rexponsibility in the MVVM

In Form-based application (WPF/MVVM/SQLServer), consider the form that handles the classical actions that you can perform on any entity. Create Read Update Delete The problem, in general terms, is ...
0
votes
2answers
136 views

Services injected with factories

I face an issue where I want to inject Entity Frameworks DbContext into a service class, in a WPF application. The problem is that the service classes are instantiated and contained by the view models....
0
votes
0answers
73 views

confusion for view's and viewmodel's responsibility in mvvm architecture in android

i have a confusion about what code should be placed in view and what in viewmodel for example click events here is a snippet code of google ToDo app example for showing application architecture (...
3
votes
2answers
962 views

Uncle Bob's Clean Architecture - Dealing with anemic interactors, tiering, and front-end MVVM

Background In Uncle Bob's Clean Architecture, use case interactors are responsible for the orchestration of business objects to accomplish some user goal. As an easy example, an e-commerce application ...
1
vote
2answers
482 views

Layered Model-View-ViewModel design

I am designing an application using C# and Windows Presentation Foundation (WPF). I would like to follow (at least) the very basic rules of software architecture, like dependicies only going in one ...
5
votes
3answers
136 views

How to design and join more complex entities

I am developing a small ERP software. I'm wondering how to design entities as well as where to join them. I'm just gonna start with an example, that makes it way easier. Say I'm modelling a ...
2
votes
0answers
57 views

Do MV* architectural patterns apply not only to OO languages but also functional languages?

I am learning about MV* architectural patterns, thanks to the help from several answers here. I learned that they are used for designing the architectures of user interactive applications. I also ...
2
votes
2answers
100 views

Where should objects be built from view-models in a layered architecture?

Having the following classes: Person.cs namespace Project.Domain { public class Person { public int Id { get; set; } public string Name { get; set; } public decimal ...
2
votes
1answer
78 views

Provide overall application status in global exception handler/crash report

In my UI application (WPF/C#, using MVVM design pattern), I have implemented a global exception handler which catches all unexpected (hence uncaught) exceptions and reports the application crash to ...
1
vote
2answers
837 views

Throttling notifications from child ViewModel to parent ViewModel

I have a child view-model which notifies on a property change: public class ChildViewModel : INotifyPropertyChanged { private bool isSelected; public bool IsSelected { get => ...
0
votes
1answer
613 views

What is the correct architecture for 4 MVVM synchronized collections related to groups and filters inside a WPF application?

I have a small architectural problem with MVVM. In this question I will note Model through M and ViewModel through VM. I have 4 collections that must be synchronized, and the items in them must have ...
1
vote
1answer
1k views

Do shared ViewModels contradict MVVM?

I want to follow the MVVM app architecture. I also need to have some communication between some fragments. But the official approach is pretty confusing. Taken from the docs (https://developer....
1
vote
1answer
447 views

IoC/DI + “normal” constructor arguments mvvm

I am using unity in C# to achieve dependency injection and inversion of control. What if I have a class, let's say a viewmodel, that depends on several services like a repository, a validator and a ...
0
votes
1answer
135 views

When to fetch/send data in an Android application

I am currently creating an Android application and I have the following questions: We have a server which provides data for the app in form of a REST-JSON-API. The App is following the MVVM ...
0
votes
1answer
3k views

Check location permissions with MVVM in Android?

I need to request runtime location permissions for the FusedLocationProviderClient api and, once I have them, obtain Location objects and feed them to an algorithm that will make a query to an ...
0
votes
0answers
84 views

How to avoid circular dependency from abstracting navigation in desktop application?

I am trying to abstract some functionality from my desktop application (JavaFX) for changing views. So, what I am thinking is: Navigator interface with methods like goToAccountsOverview(), ...
0
votes
2answers
1k views

Is it okay to pass my model into my view model via its constructor through MVVM practices?

public class LDLTrackViewModel : RailwayViewModel { private LDLTrack _ldlTrack; public LDLTrack LDLTrack { get => _ldlTrack; set { _ldlTrack = value; ...
3
votes
2answers
361 views

How to populate view models

So let's say I have a view model, representing a student. The view model is corresponding to a student model, from which the data comes. What I am struggling with, is how to populate the fields in the ...
0
votes
1answer
614 views

Where to store calculated values of an entity

Trying to figure out the best place to store calculated properties related to a base entity class for use through out the application, namely in view models and DTOs. For example, a base entity class ...
2
votes
1answer
903 views

Setters in ViewModels

So I have started reading some books and articles on architecture. They all state (put a little simply) that you should never let your view access the model directly, when using a Model-View-ViewModel ...
0
votes
1answer
226 views

Where do I save a Canvas “center position” coordinate in an MVVM architecture?

Assume I have a canvas that has rendered shapes. I can drag-move around that canvas as if I was in a zoomed in image to move all shapes around. Between the Model and ViewModel I have a ServiceLayer (...
5
votes
3answers
911 views

How to avoid duplication of types in MVVM

I'm learning the MVVM pattern and something that comes up often is a duplication of data-types. Say I have a Person datatype. Intuitively I want it to look like this: public class Person { ...
0
votes
1answer
242 views

Designing a WPF / MVVM architecture where view behavior changes in different states

As part of my bachelors thesis, I'm trying to develop something akin to a painting program. That means, I have a toolset, be it selection, drawing, highlighting, etc. I'll have a canvas that displays ...
1
vote
1answer
589 views

What is the proper way to change the View from a ViewModel when using the MVVM pattern?

I'm trying to follow the Model–View–ViewModel pattern in a Xamarin application and am wondering how the View should be able to change when a given ViewModel is finished. Below I have listed the ideas ...
2
votes
3answers
754 views

How do I architect an iOS app when multiple view models must know when the model has changed?

I'm using MVVM and I have an app with a UITabBarController, the Main tab of which is a list of publications and the other is a Search screen where they can search for publications. Searching returns a ...
1
vote
0answers
101 views

When not to use View Services in MVVM design pattern?

I'm using the MVVM design pattern in my application which is comprised of, A Xamarin.IOs project (View Layer) A Net Standard project (Common Layer) A Xamarin.Android project (in the future) (View ...
6
votes
1answer
4k views

Why can’t ViewModels communicate with each other?

Can someone explain concretely why it is not desirable for ViewModels to communicate directly with other view models? It seems to me that for virtually any UX application there will be a “root” view (...
1
vote
2answers
228 views

What is better approach to implement dependency injection using MVVM Architecture?

I need to use DispatchQueue within controller and pass it as dependency. This is what I have tried so far and worked out two solutions. Need to ask what is better and in common use by other developers:...
1
vote
1answer
100 views

MVVM/WPF/Appropriate place for code

I have a question about MVVM design, and where I should put some code that I would like to add. My application queries active directory for computers and displays the list to the user. Selecting a ...

1
2 3 4 5