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.

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.

276 questions
8
votes
2 answers

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 pattern. 1. ViewModel as application Model is representation of…
Piotr Golacki
  • 275
  • 2
  • 11
6
votes
3 answers

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.Name; } set { …
6
votes
2 answers

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 viewmodel state? Currently I have it in my view using…
ronag
  • 1,189
6
votes
4 answers

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. PeopleView might contain a ListBox ("People") which is bound…
Town
  • 250
  • 1
  • 2
  • 8
5
votes
3 answers

MVVM - child windows and data contexts

Should a child window have it's own data context (View-Model) or use the data context of the parent? More broadly, should each View have its own View-Model? Are there are any rules to guide making that decision? What if the various View-Models…
user53019
4
votes
0 answers

MVVM - Master Detail interaction scenarios - Implementing when MasterVm has partial data, and Detail has to pull whole entity

I primarily work with .Net WPF MVVM applications. I've used several frameworks, MVVM Light, Prism, etc, and I've been able to break the implementation of CRUD MVVM into three scenarios. Scenario 1: A web service returns a paged collection of small…
GetFuzzy
  • 133
3
votes
1 answer

Usefulness of the Command CanExecute as it exists in WPF

I want to question the usefulness of the CanExecute functionality in WPF (defined in the ICommand interface). As I think that you can achieve the same functionality thing without this feature I ask myself why it is there in the first place. My…
3
votes
1 answer

MVVM: Strictness of Views Referencing Models

A coworker and I have differing views on how strictly we should adhere to the MVVM concepts. I try to follow it as closely as possible where he takes shortcuts almost every chance he gets. One of my biggest annoyances is when he has views binding to…
AXG1010
  • 171
3
votes
1 answer

MVVM light Communication

I am working on a large MVVM application. I am using the MVVM light toolkit for this. The application is like a web browser with back and forward buttons. The main view is an user control. I laid the back and forward buttons in the main view user…
katie77
  • 211
  • 1
  • 2
2
votes
1 answer

What's the M in MVVM?

Is the M (model) in MVVM equal to business logic + data? Or is it just supposed to be data/state for the view? Background: In a project we use "model" as a name for an object that holds presentation data. I expect that to be wrong. In my opinion a…
nepa
  • 294
1
vote
0 answers

Correct way to store UI-specific settings in MVVM pattern

I am fairly new to MVVM. I am writing an application in which user creates a study for a physics simulation, inputs some data, runs the sim, and then views the results in graphs and tables. The application needs to have Save As / Open functionality…
1
vote
1 answer

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 computer displays some general Active Directory and…
bdan
  • 13
0
votes
2 answers

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 uses the model?
ekolis
  • 521
0
votes
3 answers

State of selected items in view or viewmodel?

Myself and my colleague were having a discussion about MVVM and how lists and selected items should be stored in view / viewmodel. I think the viewmodel should only offer up the data and allow the view to interpret it how it likes. It could display…
user3161729
  • 111
  • 1
  • 5
-1
votes
2 answers

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 logic, if you will. Therefor if the viewmodel is an…
Esguio
  • 3
  • 1