Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
1answer
56 views

Binding to Task<T> property and seting IsAsync to true

I'm trying to figure out a good way to bind the view to viewmodel properties that needs to be populated using an async method. The latest I got is using IsAsync like so. ViewModel.cs public class ...
0
votes
1answer
67 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
vote
1answer
53 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 ...
2
votes
0answers
57 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 ...
10
votes
2answers
826 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
152 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 ...
4
votes
1answer
178 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 ...
-1
votes
1answer
92 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
109 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
353 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
126 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
63 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 ...
0
votes
3answers
272 views

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 ...
1
vote
1answer
79 views

MVC: How to use data model list in recursive views

I am trying to learn web app MVC in PHP.Most of the articles discussed about 1-to-1 MVC pattern given bellow Controller: gets user request & update model, Model: receives orders form Controller &...
1
vote
0answers
46 views

How does “redux” decouple the different components so they can be tested separately in unit tests?

In the past we saw a big move from traditional MVC to MVVM for user interfaces: One of the primary motivations for MVVM is that the view and viemmodel are competely indepedently of each other and ...
1
vote
1answer
62 views

MVVM distinguish between Model and View-Model and Models relashionships on reactive architecture

This should be a simple MVVM - reactive architecture question, something that I miss probably. I'll start with a context example: I have a Music Tracks Player application with 2 models Player and ...
0
votes
0answers
88 views

MVVM composite ViewModel for sharing fuctionality (instead of inheritance)

I'm looking for design ideas for something like a composite ViewModel. I'm facing a situation where a lot of ViewModels need CRUD operations and some need refresh operations. A minority of ViewModels ...
1
vote
0answers
635 views

Proper implementation of Repository Pattern with MVVM in WPF

I am currently refactoring a WPF application that is built on the principles of the Repository Pattern. It uses Entity Framework as its ORM, and is Database First. Each of those entities is wrapped by ...
0
votes
1answer
96 views

Adding an additional layer between domain model and view model necessary?

I am working on a Xamarin application (Mvvm using Prism), I am also leveraging OData for communication between my backend and the mobile application. The structure of my Mobile app is as follows: ...
0
votes
0answers
34 views

Where to keep the code for new instance of an object in iOS project?

Example: There is a KingDetailViewController class with the following code. // MARK: - New Instance extension KingDetailViewController { class func newInstance() -> ...
0
votes
1answer
64 views

Ext JS: Designing a base class and override it

I'm trying to define a base class and override it's items on different inherited sub-classes. I'm following MVVM pattern to fetch records from backend. Created several stores and formulas within ...
0
votes
0answers
68 views

Inject ViewModels created after getting Models from DB

I am currently working on a Picture Management software where I have to follow pretty strict requirements due to specified interfaces I am not allowed to change. Therefore I am forced to have a List&...
0
votes
0answers
122 views

Should I populate view model inside or before creating it

I'm not sure if softwareengineering exchange is right for the question. I need to populate view model with some values I query from the database. I do it like: var db = new NPoco.Database(...
2
votes
1answer
156 views

ASP.Net MVC When ViewModel properties vs Ajax calls in view

When is it more appropriate to use asynchronous calls from the view to get data vs prepopulating it server-side when creating the instance of the viewmodel? For instance, if my view has some dropdown ...
0
votes
0answers
298 views

Recommended Archictecture in Android for communication between main View and RecyclerViewAdapter with MVVM

I'm trying to architect a screen with a fragment containing a date picker and some basic inputs and a list of items which more inputs. I'll try to exemplify with images: and a screen like this: ...
0
votes
4answers
296 views

Avoid type checking but preserve separation of concerns

I'm working on an MVVM project and trying to preserve separation of concerns. Our current architecture has an entity framework model and MVVM light view and viewmodel projects. I'm working ViewModel ...
1
vote
2answers
414 views

MVVM. Is it a code smell when view model has properties with names show/hide/display that semantically belong to view?

I've lately been involved with WPF and looked into MVVM. I understand that view model shouldn't be aware of view. However, sometimes I come across situation where my initial instinct is to write ...
2
votes
2answers
856 views

Adding model into another view model's collection

The Setup So I'm working on a project in which there exists a MainViewModel class. This MainViewModel contains a list of Soldiers through an observable collection. I have a button in the MainView ...
2
votes
1answer
69 views

Thick viewmodel results in thin model

How thick should a viewmodel be? For example, should my viewmodel or model handle the actual filtering? For example, let's say I have a Roster object holding a collection of Users which are ...
2
votes
1answer
191 views

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 ...
0
votes
0answers
246 views

MVVM Portable ViewModel / WPF/Xamarin Messaging

I have a WPF app targeting .NET 4 which I am updating and maintaining for a customer. In the course of the project, we have also ported the functionality to a Xamarin mobile app. I was able to ...
0
votes
2answers
2k views

Overall view validation with a datagrid and keeping to MVVM

I am struggling to find a good architecture for what must be a common problem Enable/Disable a button in a View that contains a datagrid, and has validation requirements on the cell, row and ...
3
votes
1answer
3k views

WPF MVVM Loading data on startup

I am building a simple master-details GUI using WPF/MVVM/Prism for some data coming from a Restful service. I have the main window as my main view with a corresponding view model. I have a user ...
1
vote
2answers
2k views

How to implement validation before setting a property value in MVVM (WPF)

Scenario. ViewModel has a property State. View has a ComboBox that allows to change value of State. ViewModel needs to run some validation (call bool ValidateState(State value) method) before setting ...
1
vote
2answers
3k views

MVVM Correct way to switch between views occupying the same footprint on the screen

An example is switching the main view according to the selected item in a hamburger menu. Also sometimes it is just a small part of the GUI that changes according to the application state or according ...
1
vote
1answer
411 views

Is it right to have dependenties to my Viewmodel from data acces layer and view layer

Context In my application I use the MVVM pattern. I'll have a ViewModel that can contains information of a student. This viewmodel is used to communicatie between my view and model. I use ASP.net ...
0
votes
1answer
857 views

Duplicating Domain Model in View Model or not

I have an XML file that contains configuration information for a system. I can serialize/deserialize the XML into a hierarchy of objects that describe the configuration (and no more) and then pass ...
-1
votes
2answers
252 views

Should i be using My own MVVM implementation?

Hi there i've been into MvvM and modular design the last few days, i find it really nice design principle that be scaled and maintained really well. But here is the thing, i see there are multiple ...
2
votes
2answers
3k views

How to separate the ViewModel from the Model, yet associate them with each other based on the Model?

In a wpf application, a Model object is created either from scratch or deserialized from some .xml file. To create a connection to the ViewModel, the following method (on the Model!) is used by the ...
0
votes
0answers
58 views

How to share this kind of logic between view-models

Two view-models, each for a separate screen, have an ICommand which has same logic: it needs to choose between asking the user to choose from a list of items or choose an item automatically. How ...
3
votes
1answer
1k views

MVVM communicate between views

I know we can use the Mediator Pattern to communicate between view models but what about views? Lets assume I have a button in View A which should trigger functionality of View B. How is this ...
5
votes
1answer
513 views

MVVM Persistence from view model

I'm new to MVVM, I get the general idea, but there's one thing that I've been having a tough time finding an answer for. Inevitably an application will have a save button in the UI. The UI talks to ...
0
votes
0answers
51 views

MVVM/Xamarin implementing services that require other services

Currently, I have a xamarin app that has a database, web service and 2 other services to handle the logic between the database/web service and the ui. I'm trying to make it all async, and therefore I ...
0
votes
1answer
84 views

MV(X) Patterns: How much nesting is too much? Is not enough?

Posts may be smaller than they appear! Skip the bulleted list. Lemme Just Say... I know that this is going to be largely (entirely...) opinion-based. Everyone has their own approach, and their own ...
1
vote
1answer
156 views

WPF – Arrangable row of rectangles

I originally posted this on StackOverflow, but got the message that this was the correct forum for such a question. https://stackoverflow.com/questions/44077183/wpf-arrangable-row-of-rectangles. I am ...
0
votes
2answers
1k views

Distinguishing the differences between view model and service layer

First project trying to use MVVM and Xamarin Forms, so please be gentle; however, I am at a lost on how to differentiate between the logic that belongs in the view model and model/service layer. I am ...
2
votes
1answer
245 views

MVVM, example of use in iOS

I have a view controller with a mapview (Apple Map), on top of that there is a view with a button and a textfield. The view is compacted around the search button, when I touch it it expands revealing ...
0
votes
1answer
2k views

Multithreaded C# MVVM Application Architecture

I have an application built in C# using the MVVM pattern that will have 40-50 different tests that need to be run. I want to show each test as a list item with a progress bar of how far each test has ...
6
votes
2answers
505 views

Should I remove “everything” from my controller in MVVM?

I'm working with Xamarin and we are following the MVVM design pattern. For those who don't know what Xamarin is, it's a technology that allows us to build iOS and Android apps with shared code. ...
1
vote
1answer
88 views

If I have to check integrity of the strings coming from the View, where should I do it?

The scenario: I have a GUI with textfields and radio buttons where the user insert information for a 'Person' Here are the classes of the model and of the view-model: enum Gender { case Male, ...