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
-1
votes
1answer
28 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
76 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
71 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
128 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
69 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
115 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
52 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
72 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
55 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 ...
3
votes
5answers
815 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
92 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
61 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
133 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
63 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 (...
2
votes
2answers
443 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 ...
0
votes
2answers
129 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
132 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 ...
1
vote
0answers
55 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
76 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 ...
0
votes
1answer
467 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
315 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 ...
0
votes
1answer
712 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....
0
votes
1answer
309 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
71 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
2k 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
71 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
746 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
1answer
214 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
216 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
524 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
144 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
581 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
163 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
434 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 ...
1
vote
3answers
305 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
90 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 ...
4
votes
1answer
2k 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
220 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
95 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 ...
2
votes
1answer
2k views

When to use The Messenger (Mediator) Pattern in MVVM design

I got confused with the role of the Messenger in MVVM. I see contradictory articles about it. This Article by MSDN by: Communicating from the View-Model to the View Observant readers will ...
4
votes
2answers
751 views

Propagating Data to multiple ViewModels - C#

I'm a bit new to MVVM, but here's my dilemma: I have a model (or models, but let's keep it simple) I want to show that model data on multiple different views. Ok, so ViewModel for each view gets ...
17
votes
2answers
5k views

Clean Architecture: What is the View Model?

In his book 'Clean Architecture', Uncle Bob says that the Presenter should put the data that it receives into something he calls the 'View Model'. Is this the same thing as the 'ViewModel' from the ...
1
vote
2answers
673 views

How should I Implement a general method that could be used across several view models?

Currently I have implemented a method in to a model to take a screen shot like so E.G. Interface public interface ICapture { void CaptureMethod(); } This is the model that implements that ...
5
votes
1answer
553 views

Where is it better to implement Copy/Cut/Paste in MVVM?

I am working on a project using C#/WPF and following MVVM pattern. This project is designed for touch screens. The major objects of the program are the following: We have Programs which contain ...
0
votes
1answer
723 views

Giving Viewmodels access to application wide Model in MVVM

I am practicing building applications using MVVM and WPF+C# by making a "finance application". The application contains several views with their own ViewModels. The views are in a hierarchy and are ...
-1
votes
1answer
204 views

MVC / MVVM principles

I'm currently working on updating some old projects (inherited stuff) and I keep running into various small issues with the architecture. Namely monolithic classes too tightly coupled. One example ...
1
vote
3answers
385 views

When to use Parameters and When Not to C#

I am have an application using MVVM pattern. It takes a user ID and returns a table with the user's bookmarks. I am trying to decided if it is better practice to include parameters in my model's ...
5
votes
1answer
703 views

Approach for Constructing View Models in Complex MVVM Application

I'm struggling with the design in a WPF MVVM application. In a few courses I've taken, they say that having a lot of parameters in a constructor is a code smell, but they never address how to deal ...
3
votes
1answer
113 views

View-model architecture

I have two screens: A screen with a list of items, where every item in the list has "Show Details" and "Update buttons" An item details screen. The "Show Details" button navigates to item details ...

1
2 3 4 5