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
1 answer
75 views

am I understanding MVVM correctly? [duplicate]

ViewModel has Two-way data binding with UI which means UI can access the data from ViewModel and can update the view models data. The Model has one-way data binding and is only supposed to respond ...
  • 9
0 votes
0 answers
37 views

Android clean architecture - RemoteMediator with multiple api dependencies and data sources

From the docs, a RemoteMediator used for pagination can have dependency on: Api Service Database Consider the case when you are paginating a list of items, say a list of books for which you have a ...
4 votes
1 answer
218 views

Does my View Model violate the Single Responsibility Principle? Or am I just used to toy examples from tutorials?

I am a very beginner writing one of my first webapps. I'm using FastAPI and I'm stuck on the logic of creating an endpoint that has to do a lot of things before it returns something back to the user. ...
  • 149
0 votes
1 answer
99 views

MVVM - Wrapping Class For ViewModel

I am using a networking library I created which contains a Client class. I have a GUI which will display all these clients in a ListView with columns, such as one containing their online status. The ...
  • 113
0 votes
1 answer
227 views

Clean code and SOLID principles in WPF/MVVM view models?

I'm currently reading "Clean Code" by Robert Martin (which I should have read years ago), and it's given me a bit of a wakeup call, especially regarding keeping methods and classes small, ...
0 votes
0 answers
109 views

Custom templated controls, user control and MVVM approach

I am developing a data visualisation tool, with some UI interactivity after initial trail with doing it mostly by using templates in XAML and code behind to handle interactive stuff I've realised that ...
1 vote
0 answers
360 views

WPF Best way to create viewmodel from another viewmodel

Often I want to open a new window from within some view. I see opening a window as view logic. So I don't want code in my viewmodel that creates/opens/changes windows or anything else that interacts ...
2 votes
2 answers
323 views

Repository w/ MVVM Pattern: Data Format Check, Where/When, Best Practice?

TL; DR Where/When to check data format in MVVM + Repository Pattern is the best practice? Any suggestion or theory? The Scene Our team is working on an Android Project. We have a MVVM+repo structure: ...
5 votes
2 answers
589 views

In MVVM, how much of the business logic should reside in the View Model, and how much should reside in the Model?

I wondered what is the "correct" or "intended" interpretation of MVVM? I worked mainly with WPF but I guess it is still relevant to all platforms embracing MVVM architectural ...
1 vote
0 answers
62 views

Issue implementing the Command Processor pattern using MVVM for WPF?

I'm trying to implement the Command Processor pattern using MVVM for WPF. The Command Processor pattern that I'm roughly following is the one described in the book Pattern-Oriented Software ...
  • 133
2 votes
1 answer
133 views

Data visualisation application for WPF and MVVM

I was wondering what is the best approach for a Data visualisation application for WPF and MVVM The key points are: The data is loaded, or needs just a little preparation such as pulling out ...
2 votes
1 answer
78 views

How to set up MVVM for highly dependent hierarchical objects with 3D representation

Imagine a program that designs plates with geometric cutouts. You start with a rectangular plate. A plate can have one or more rectangular depressions carved out of it. Each of these can have one or ...
  • 121
0 votes
1 answer
548 views

RESTful web APIs using MVVM architecture

As the title implies, I would like to know if it is possible to create RESTful web APIs using MVVM architecture? Or we can use just MVC pattern to create web APIs?
  • 103
-2 votes
1 answer
72 views

Store/Pass User data MVVM+C swift

I have an app written using MVVM and RxSwift. For navigation I'm using coordinator What is the best way to store user's credentials and pass them to Network Layer. I don't want to sore them in DB or ...
  • 107
2 votes
1 answer
367 views

What is the MVVM way of loading images in list in Android?

Scenario: A very simple android app needed to be developed. It has just one screen with a list of items. Each item has a label and an icon. We fetch the item list from the server, and the server ...
2 votes
2 answers
720 views

What's the better way to do MVVM with a number of very similar view models?

An important view in our application is a big table of entities. For the purposes of this question I'll use an analogy for our entities - so let's say it's vehicles. There's half a dozen different ...
0 votes
1 answer
78 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
1 answer
50 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 ...
3 votes
1 answer
4k 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 ...
  • 141
1 vote
2 answers
2k 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 ...
  • 117
4 votes
0 answers
667 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 ...
1 vote
1 answer
205 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
1 answer
198 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 ...
  • 59
0 votes
0 answers
247 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 ...
  • 181
-2 votes
1 answer
110 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
0 answers
66 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
1 answer
656 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# ...
  • 101
1 vote
2 answers
721 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 ...
  • 61
2 votes
1 answer
469 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 ...
  • 157
0 votes
1 answer
1k 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 ...
  • 89
0 votes
1 answer
234 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
0 answers
602 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. ...
  • 119
0 votes
0 answers
171 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
2 answers
93 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 ...
  • 11
0 votes
2 answers
89 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 ...
  • 491
6 votes
5 answers
8k 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
2 answers
569 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 ...
  • 13
0 votes
1 answer
187 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 ...
  • 831
0 votes
2 answers
145 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
0 answers
81 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 (...
  • 187
3 votes
2 answers
1k 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
2 answers
765 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
3 answers
161 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 ...
  • 375
2 votes
0 answers
60 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 ...
  • 5,301
2 votes
2 answers
115 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
1 answer
86 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
2 answers
1k 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 => ...
  • 693
0 votes
1 answer
905 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
1 answer
2k 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
1 answer
536 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 ...
  • 375

1
2 3 4 5 6