Questions tagged [mvvm]

Model-View-ViewModel (MVVM) is an architectural design pattern for implementing user interfaces that separates the UI (the View) from its data (the Model) via its presentation logic (its ViewModel).

Model-View-ViewModel (MVVM) is an architectural design pattern for implementation of user interfaces. Its primary focus is on separation of concern between the View (UI) and the Model (Data) by using an intermediate layer called a ViewModel to enhance manageability, scalability, and testability.

It is used in all based frameworks including , , ,,, the ZK framework and frameworks including KnockoutJS. Popular .Net frameworks implementing the pattern include:

See Also:

29966 questions
7
votes
2 answers

MVVM Datagrid first row selected by default but not highlighted

I have a datagrid which is bound to a collection on my ViewModel. When the window loads the datagrid is populated and the SelectedItem is set. (I know this because I have a detail view bound to the selected item.) The row however is not…
jrandomuser
  • 1,510
  • 19
  • 50
7
votes
1 answer

WPF databind Image.Source in MVVM

I'm using MVVM and am trying to databind the Source property of Image to my ViewModel in such a way that I can change the icon on the fly. What is the best pattern to follow for this? I still have the flexibility to change my ViewModel to suit, but…
BrettRobi
  • 3,793
  • 7
  • 40
  • 64
7
votes
2 answers

WPF Command binding in DataTemplate

I'm using ItemsControl to hold my collection. The ItemsPanel is a Canvas, the ItemTemplate is a block of Border>StackPanel>TextBlocks I want to bind a command in the DataTemplate to catch the click on a block (item of my collection) Code:
Stacked
  • 6,892
  • 7
  • 57
  • 73
7
votes
4 answers

Android MVVM Design Pattern

I have read in the recently released 'Android Best Practices' book that a good design pattern to use for android programming is MVVM. Having tried it myself on my latest project it does seem to be beneficial in separating code into more manageable…
7
votes
4 answers

How reusable should ViewModel classes be?

I'm working on a WPF application, and I'm structuring it using the MVVM pattern. Initially I had an idea that the ViewModels should be reusable, but now I'm not too sure anymore. Should I be able to reuse my ViewModels if I need similar…
stiank81
  • 25,418
  • 43
  • 131
  • 202
7
votes
2 answers

Automatically Raise PropertyChanged when an inner object property got changed

I got a scenario like this Class Parent { Property A; } Class A { Property X } How can I get a PropertyChangedNotification on Property A when X changes? I don’t want to refer ‘Parent’ in class A or any kind of event which spoils…
Jobi Joy
  • 49,102
  • 20
  • 108
  • 119
7
votes
1 answer

WPF DataGrid Performance without virtualization

I just got a question concerning the Microsofts PresentationFramework´s DataGrid: I have an ObservableCollection. TestModel is a simple class with 20 Int properties... nothing more. In my test there are 50 Entries in my…
Robert Nagel
  • 183
  • 1
  • 7
7
votes
6 answers

Why is the DataGridRow IsSelected binding not working on DataGrid

In Josh Smith's MVVM demo he's uses a ListView with a ListViewItem style like this: