In my application, I have several ViewModels that have a separate service (repository, DAO, whatever), let me call it the WidgetService introduced in them.
Let's say that one of these ViewModels is a list of all user widgets. Another may be a ViewModel for editing / creating one of these widgets.
The user can view the list of widgets WidgetListView supporting WidgetListViewModel and click a button to add a new widget. To create this new widget, CreateWidgetViewModel is updated and inserted into the DataContext of some UserControl / Window, thus, thanks to the magic of DataTemplates displaying CreateWidgetViewModel in CreateWidgetView . In addition, the innovation of CreateWidgetViewModel does not necessarily occur as part of the WidgetListViewModel .
When the WidgetListViewModel instance of WidgetService was added . CreateWidgetViewModel This WidgetService tag has been added .
Now, when the user clicks on save in CreateWidgetView , the Save method in WidgetService will be called and the widget will be saved. Now WidgetListViewModel needs to be notified about the appearance of a new widget!
A lengthy build leads to this question: how can I let WidgetListViewModel know that it needs to display a new widget?
Video, Microsoft , , ViewModel . , , , viewmodel GC'd, GC'd. IDisposable ViewModel. , / Dispose, ViewModel DataTemplates?
- - ?
, , MVVM . , MVVM- Crack.Net.