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
3
votes
0answers
62 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 ...
4
votes
1answer
762 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 ...
6
votes
3answers
877 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 ...
1
vote
0answers
2k 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
139 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: ...
21
votes
6answers
14k 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 ...
2
votes
1answer
4k views

When using MVVM, is it okay to use property injection on a view model in WPF?

I am rather new to the concept of MVVM in C#/.NET WPF projects. The way I understand it, the view-model is supposed to lessen the amount of code-behind required to display data on a form. I try to do ...
0
votes
1answer
83 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
252 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(...
0
votes
1answer
1k 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 ...
2
votes
1answer
300 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 ...
5
votes
2answers
626 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. ...
0
votes
4answers
654 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
664 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
1answer
106 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
292 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 ...
7
votes
4answers
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 - ...
0
votes
2answers
3k 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
5k 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
4k 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
1answer
794 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 ...
5
votes
2answers
238 views

Should I create a (new) project for shared UserControls?

Context: I'm creating some applications to help me on my daily tasks, it does not connect anywhere and the only "data" it has to deal with is the parameters that I enter on the input fields. This is ...
0
votes
2answers
419 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
1answer
266 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 ...
3
votes
1answer
2k 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 ...
1
vote
1answer
258 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
1answer
93 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 ...
3
votes
4answers
1k views

Multi-screen MVVM architecture/design - Should my “screen” ViewModels contain sub-ViewModels?

I'm getting beyond a simple MVVM program now, and I'd just like to sense check my current architecture and makes sure I'm going down the right path here. Everything is structured around screens, and ...
0
votes
2answers
2k 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 ...
0
votes
1answer
4k 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 ...
1
vote
1answer
105 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, ...
3
votes
2answers
952 views

State handling in WPF-MVVM

I am looking for advice on handling states in a WPF MVVM environment. As an example, assume we have A TreeView (or some other ItemsControl) with some items and a button that is enabled when an item ...
-1
votes
1answer
3k views

Can MVVM architecture be used in designing web applications?

One of the client for whom I had worked has a MVVM architecture for web application.I dont know why they incorporated instead of MVC. is this a feasible idea because as far as I have gone through all ...
1
vote
2answers
2k views

Preserve MVVM while using XAML resources

Context: I'm creating a WPF application using MVVM. I have a Page which displays a status informing what task the app is performing on Background. I have a container, and bind its Content to an ...
2
votes
2answers
456 views

Is it improper to have an application wide source for dropdown binding

The WPF Combobox needs to bind a collection to it's ItemsSource and something to bind the selected item or value to. Until now, I've included both the collection and the selected value properties that ...
17
votes
5answers
24k 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 ...
5
votes
1answer
3k views

MVVM best practices with WPF client and WCF duplex service

I've been thinking about how to design my WPF application, which receives data from a WCF duplex service, but I'm afraid of over engineering. I thought about abstracting away the WCF communication ...
1
vote
1answer
673 views

MVVM, is it better suited for web applications or GUIs?

I am currently deciding whether I should implement a new system with a web application as a front-end, or if I should instead produce an executable file using WPF. The pattern that I will use is MVVM,...
0
votes
1answer
2k views

Is MVVM the right choice for a single-developer WPF project?

I'm starting to design and develop a WPF application for my company and one of the first choices that I have to make is whether or not to use MVVM. The main points to consider are: The application ...
3
votes
1answer
654 views

MVVM Inheritance following SOLID principles

I'm currently at the design phase of my program (hence no code). It will be written in WPF in C# using MVVM principles. I'm going to have a multifunctional Drag & Drop control, that will act ...
3
votes
1answer
360 views

CQRS: how granular should the queries be?

I have a system that uses CQRS with the Queries written using Dapper. It's worked out well, except that there has been a proliferation of query classes that do almost the same thing. The downside of ...
6
votes
1answer
7k 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 ...
11
votes
2answers
9k 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 ...
2
votes
1answer
840 views

JavaScript - Client-side separation of Model and ViewModel?

I am developing web apps using the Model-View-ViewModel approach with Knockout.js. After reading on the original introduction of MVVM by John Gossman, I realized that my ViewModel always contains ALL ...
2
votes
2answers
1k views

Invoke model logic in one UserControl from view-model in another UserControl without violating MVVM

Here is WPF application consisting from 3 UserControls: UserControl3 is a part of UserControl2 content. I keep MVVM during developing and using Prism. I need to invoke custom class method (which is ...
0
votes
1answer
326 views

How to properly organize multiple WPF/Entity Framework applications that share resources?

Company A is building 5 separate in-house WPF applications, and they would like to share UserControls, ResourceDictionaries, and ADO Entity Data Models between each project. They would also like to ...
1
vote
1answer
72 views

How to test dynamically created HTML when the tests are in a separate file?

Code context I have a complex page as part of my web app that is dynamically populated with information using knockout.js. The page has dynamically created anchor tags that link to each other. For ...
0
votes
1answer
1k views

MVVM Model vs. DDD Entity

I have just stepped into the Domain Driven Design paradigm but I have one question: How is an MVVM Model different from a DDD Entity? What are the differences between these two?
2
votes
3answers
1k views

Including the type name in a variable name

Abstract: Is it acceptable to include the type name in the variable name? My scenario: I am working with C# MVVM, and I have a lot of ICommand properties in my ViewModel, named various things like ...
1
vote
1answer
681 views

MVVM with DI, view model location and shared service data

I have a couple of questions regarding MVVM view models. I have 3 view models in my scenario, which I have put together a shorter sample below. I was looking for a nice solution for 3 views working ...