model-view-viewmodel

Where should 'CreateMap' statements go?

I frequently use AutoMapper to map Model (Domain) objects to ViewModel objects, which are then consumed by my Views, in a Model/View/View-Model pattern. This involves many 'Mapper.CreateMap' statements, which all must be executed, but must only be executed once in the lifecycle of the application. Technically, then, I should keep them ...

How can I execute WPF filters on a background thread?

Hi, I'm using filters in WPF and I'm following the pattern suggested here. To summarize, this involves a text property being exposed on the ViewModel which represents the text to filter by. When the property is set (by the binding from the textbox in the View) it uses CollectionViewSource.GetDefaultView(MyItems).Filter = blah to filter...

How to implement IEditableObject for View Model?

Suppose I have VM with some entities as property. Say People, Addres, Phone, .... Then I want to implelemt IEditableObject on VM so that user have undo functionnality. What's the best way to implement request? Demo code please. ...

How to get TextBox inside DataTemplate in a ListBox to notify the ViewModel on value change

What I need to find is when a textbox's value is changing or the dropdown's value changes inside my datatemplate item, I need to be notified in my ViewModel.cs. So basically as a user edits a textbox inside the listbox, the viewmodel will be notified as the values are changing. The reason is I need to go through all my Entries and upda...

wpf viewmodel first approach - multiple instances of same usercontrol in same view.

Hi, We are folllowing mvvm approach for a wpf application. We have are following view-model approach..I mean we create view-models and map them using <DataTemplate DataType="{x:Type vm:CityViewModel}"> <vw:Cities/> </DataTemplate> In this city - view ..I have a user control...which I am using multiple times... <view:Us...

asp.net MVC "Add View" wizard won't pre-populate fields when using a ViewModel

In VS 2010, When you use the "Add View" wizard to create an Edit view with a strongly typed view, such as Models.Person, the template generates all of Person fields for you. If you use a view model instead, like this: public class PersonVM { public Person person; public List<Team> TeamList = new TeamServices().TeamPickList(); ...