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
49 votes
10 answers
32k views

Under what conditions is the use of MVVM appropriate?

Model View View-Model was developed by Microsoft to target UI development platforms which support event-driven programming, specifically Windows Presentation Foundation (WPF) and Silverlight on the ....
Kelly Sommers's user avatar
39 votes
3 answers
31k views

Who should control navigation in an MVVM application?

Example #1: I have a view displayed in my MVVM application (let's use Silverlight for the purposes of the discussion) and I click on a button that should take me to a new page. Example #2: That same ...
SonOfPirate's user avatar
  • 2,915
33 votes
4 answers
35k views

How to choose NOT to use a framework (Caliburn.Micro, etc.) in a given MVVM application?

I have once started a MVVM/WPF project, which was eventually built and deployed, and for that I studied a lot of the Caliburn.Micro MVVM Framework. The fact is: I ended up not using Caliburn.Micro for ...
heltonbiker's user avatar
  • 1,048
31 votes
1 answer
10k views

Is there a good formal pattern to manage state in MVVM?

I have started learning about Redux and React in the web-world, and the more I learn about it the more I'm realizing how painful state management is in the desktop-world with WPF's MVVM-style ...
willem's user avatar
  • 1,053
25 votes
2 answers
13k 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 ...
Fearnbuster's user avatar
24 votes
2 answers
20k views

Help with complex MVVM (multiple views)

I need help creating view models for the following scenario: Deep, hierarchical data Multiple views for the same set of data Each view is a single, dynamically-changing view, based on the active ...
jayars's user avatar
  • 622
22 votes
6 answers
18k views

Should we bind view to a model property or ViewModel should have it's own..?

I am starting a project with following technical environment : .Net 4.0, Entity Framework 4.0, WPF with MVVM Architecture I saw lots of examples on the net, some books with this environment. In some ...
Pravin Patil's user avatar
22 votes
5 answers
9k views

Are value converters more trouble than they're worth?

I'm working on a WPF application with views that require numerous value conversions. Initially, my philosophy (inspired in part by this lively debate on XAML Disciples) was that I should make the view ...
devuxer's user avatar
  • 676
20 votes
2 answers
18k views

Is MVVM in WPF outdated? [closed]

I'm currently trying to get my head round MVVM for WPF - I don't mean get my head round the concept, but around the actual nuts and bolts of doing anything that is further off the beaten track than ...
Benjol's user avatar
  • 3,727
18 votes
5 answers
28k views

How to make creating viewmodels at runtime less painful

I apologize for the long question, it reads a bit as a rant, but I promise it's not! I've summarized my question(s) below In the MVC world, things are straightforward. The Model has state, the View ...
dvdvorle's user avatar
  • 849
17 votes
3 answers
9k views

MVVM Clarification

We are about to write our first WPF application and are becoming familiar with the MVVM pattern. We've built many Winform applications and have an architecture that has been very successful for us. ...
user7676's user avatar
  • 273
17 votes
3 answers
12k views

MVVM, DDD, and WPF Layered Application Project Structure Guidance

I am trying to setup my application's structure in VS and I want to "try" and future proof it to a reasonable level. This application will be a WPF re-write of an old Winform app that had followed no ...
Refracted Paladin's user avatar
15 votes
3 answers
25k views

MVVM and service pattern

I'm building a WPF application using the MVVM pattern. Right now, my viewmodels calls the service layer to retrieve models (how is not relevant to the viewmodel) and convert them to viewmodels. I'm ...
alfa-alfa's user avatar
  • 153
14 votes
4 answers
1k views

Proper Model-View-_____ design

I've been reading up about Model View Controller, Model View Presenter, Model View ViewModel, and so on, and generally, the underlying concept seems pretty simple to understand: keep the pretty ...
KoratDragonDen's user avatar
13 votes
2 answers
15k views

In MVVM, should ViewModel or View be responsible for creating new views?

In my WPF application, I want to create a new view. Where should I do that - in ViewModel or Model? The application is a (very simple for now) one-window form-like tool with single "send" button. In ...
Mac70's user avatar
  • 356
13 votes
3 answers
21k views

MVVM or MVC? Want to use the same set of classes for WPF and ASP.NET

I am a newbie in terms of Design Patterns. I just started learning MVC when I am hearing a new buzz, MVVM. I want to learn the insights of both of these by redesigning an old inventory and invoicing ...
RPK's user avatar
  • 4,378
13 votes
5 answers
14k 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 ...
Pseudonymous's user avatar
13 votes
1 answer
10k views

Reactive programming vs MVVM pattern for managing GUI updates

Reactive programming and MVVM are two approaches that can address the problem of separating the domain layer from the UI. MVVM does this by defining a viewmodel, which is a data structure mapped to ...
Simon Bergot's user avatar
  • 7,980
11 votes
1 answer
9k views

Best practices for implementing MVVM and MVC in delphi Pascal

I'm a Delphi pascal programmer, I use the latest Embarcadero delphi XE, and I would like to take advantage of design patterns such as Model view controller and model view view-model. However, there ...
sav's user avatar
  • 225
10 votes
3 answers
28k views

What the best way to wire up Entity Framework database context (model) to ViewModel in MVVM WPF?

As in the question above: What the best way to wire up Entity Framework database model (context) to viewModel in MVVM (WPF)? I am learning MVVM pattern in WPF, alot of examples shows how to implement ...
hal9k2's user avatar
  • 103
10 votes
1 answer
3k views

Value of MVVM in a Line of Business Application (and a Rant of Current Development Practices)

After 2 years, I'm still struggling with MVVM as a practical method of producing working software. In some cases it's great. I did a multithreaded application that controlled a small assembly line ...
b_levitt's user avatar
  • 201
9 votes
2 answers
11k views

C# .NET MVVM software architecture and naming conventions

I am currently working on a software using C# .NET and WPF with the MVVM pattern. Though the software is almost done, I have been discussing our architecture for a long time and I would like to get ...
Rashimov Azarov's user avatar
8 votes
2 answers
4k 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 ...
Piotr Golacki's user avatar
8 votes
2 answers
651 views

How can I "get in the know"?

My company posted a job listing to get me a helper. A recruiter called me today and all he kept saying was "MVC this Entity Framework that..." - He sounded shocked when I said the project uses ...
Aaron Anodide's user avatar
8 votes
1 answer
8k 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 ...
Woodstock's user avatar
  • 191
8 votes
1 answer
5k views

Is ViewModel with more than one repository bad?

I'm working on a project with MVVM. Some ViewModels have more than one repository. Is ViewModels with more than one repository bad? Please provide with why it's good/bad.
Amir Rezaei's user avatar
7 votes
4 answers
2k views

Clean, Modular Code vs MV* Frameworks [closed]

I've been hearing a lot about the "new" MV* frameworks. I've tinkered with KnockoutJS (I created an invoicing application), but I much prefer to write clean, modular code in raw JavaScript - ...
culturalanomoly's user avatar
7 votes
5 answers
24k views

MVVM ViewModel and Commands

I need a bit of help to understand the relationship between a viewmodel and a command, and the responsibility of the viewmodel. I'll try to give an example (using Caliburn Micro). I have a viewmodel ...
Karsten's user avatar
  • 321
7 votes
4 answers
25k views

How to organize MVVM files in solution

I'm fairly new to the MVVM concept but like a lot of the flexibility it gives me so far. However, I'm struggling to find a good way to manage my code. I have several classes that are just sitting in ...
lumberjack4's user avatar
7 votes
3 answers
2k 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 { ...
asaf92's user avatar
  • 201
7 votes
1 answer
4k views

Which notification pattern is preferable?

I'm working on a view model for a view that presents a dialog with export options. The user selects options then clicks Export. When the view model completes the Export, the calling view model ...
devuxer's user avatar
  • 676
7 votes
1 answer
6k 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 (...
Jason's user avatar
  • 171
6 votes
3 answers
1k views

What are the rules for coupling a ViewModel and a View in the MVVM pattern?

So given the Separation of Concerns, how coupled should the View and ViewModel be? For example, I want the visibility of a Control in the View to be databound (databinded?) to a flag in the ViewModel....
Alan's user avatar
  • 239
6 votes
1 answer
5k views

Wpf: Event driven vs MVVM design pattern

I'm a beginning coder and I've been working on a WPF app for several months now and struggled to implement anything in MVVM due to time constraits to learn so I coded my program the only way to knew ...
user2525395's user avatar
6 votes
4 answers
8k views

Who is using the MVVM architecture for large applications? [closed]

I am currently working on an LOB application which I am basing on the MVVM architecture. Going by the answers to the questions I'm asking, it seems like there are not that many people building large ...
dave's user avatar
  • 2,466
6 votes
3 answers
10k views

MVVM Commands - one command for everything or multiple commands?

In my last company, on handling view commands, in the ViewModelBase there were one central command implemented, like public ICommand ToolCommand { get; set; } And in the ViewModelBase, it's been ...
user avatar
6 votes
4 answers
10k views

Lists & Collections in MVVM - which approach to take?

I'm currently working on a Silverlight app using Caliburn.Micro. At present, we have Views (eg: PeopleView) and View Models (eg: PeopleViewModel) that equate to 'pages' of the application. ...
Town's user avatar
  • 250
6 votes
1 answer
6k views

WPF, MVVM, EF, POCO guidance required on simple architecture

(sorry for my poor english) I am developing a application using WPF, EF Code First using MVVM (Caliburn.Micro). It should be used mostly to CRUD work. I created a BaseViewModel<T> class from ...
user1576950's user avatar
6 votes
2 answers
4k views

MVVM Reporting App Approach ? Data Access Layer?

I'm trying to follow the MVVM pattern in a reporting / statistics application that I'm making in C# / WPF. I have made many model classes to hold properties as a starting point. Some of these models ...
Bat Masterson's user avatar
6 votes
1 answer
3k views

Usage of MVVM in iOS

I'm an iOS developer and I'm guilty of having Massive View Controllers in my projects so I've been searching for a better way to structure my projects and came across the MVVM (Model-View-ViewModel) ...
Isuru's user avatar
  • 391
6 votes
2 answers
6k views

Is a 'God' ViewModel desired in WPF

My application has user controls within user controls. Please see a screen shot of one of the most beautiful applications of all time (UC = user control): All the properties live in the MainWindow ...
Dave's user avatar
  • 662
6 votes
1 answer
9k views

What's the best way to expose a Model object in a ViewModel?

In a WPF MVVM application, I exposed my model object into my viewModel by creating an instance of Model class (which cause dependency) into ViewModel. Instead of creating separate VM properties, I ...
Angel's user avatar
  • 161
6 votes
2 answers
3k views

Should Item Grouping/Filter be in the ViewModel or View layer?

I'm in a situation where I have a list of items that need to be displayed depending on their properties. What I'm unsure of is where is the best place to put the filtering/grouping logic of the ...
ronag's user avatar
  • 1,189
6 votes
1 answer
1k 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 ...
Adam's user avatar
  • 169
6 votes
2 answers
3k views

Why should ViewModel route actions to Controller when using the MVCVM pattern?

When reading examples across the Internet (including the MSDN reference) I have found that code examples are all doing the following type of thing: public class FooViewModel : BaseViewModel { ...
Lea Hayes's user avatar
  • 1,043
6 votes
3 answers
4k views

When using MVVM, should you create new viewmodels, or swap out the models?

Say I have a viewmodel like this: public class EmployeeViewModel { private EmployeeModel _model; public Color BackgroundColor { get; set; } public Name { get { return _model....
ConditionRacer's user avatar
6 votes
3 answers
1k views

Modular Filter Architecture for WPF

I am creating a little stock-management tool for private use. I have different views, which need similar but different filters. As an example I have a "current stock" list where I can filter for ...
lolsharp's user avatar
  • 173
6 votes
1 answer
471 views

Design patterns for navigation between pages on mobile platforms

I'd like to ask you about the best way of handling navigation between pages/activities on mobile platforms. To be more specific - about handling state in more complex apps, about handling 'Back' ...
psmyrdek's user avatar
6 votes
2 answers
643 views

Given the presentation model pattern, is the view, presentation model, or model responsible for adding child views to an existing view at runtime?

I am building a Flex 4 based application using the presentation model design pattern. This application will have several different components to it as shown in the image below. The MainView and ...
Ryan Taylor's user avatar
  • 1,026
6 votes
3 answers
2k views

Loose Coupling Presenter to View in MVP

We work in a Java shop here and our web application uses an implementation of the MVP architectural pattern. Our manager comes from a .NET world, where he has been exposed to the MVVM design pattern. ...
Mihai Danila's user avatar

1
2 3 4 5 6