The window manager can now also create just view models (without immediately binding a view); added MultiPageViewModel as a base class for the common case of view models that embed multi pages they can switch between; added missing copyright statement for the late checked synchronization context
git-svn-id: file:///srv/devel/repo-conversion/nuwi@49 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
parent
a17926d02e
commit
2b908f18eb
4 changed files with 60 additions and 1 deletions
|
|
@ -239,6 +239,25 @@ namespace Nuclex.Windows.Forms {
|
|||
return viewControl;
|
||||
}
|
||||
|
||||
/// <summary>Creates a view model without a matching view</summary>
|
||||
/// <typeparam name="TViewModel">Type of view model that will be created</typeparam>
|
||||
/// <returns>The new view model</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This is useful if a view model needs to create child view models (i.e. paged container
|
||||
/// and wants to ensure the same dependency injector (if any) if used as the window
|
||||
/// manager uses for other view models it creates.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// This way, view models can set up their child view models without having to immediately
|
||||
/// bind a view to them. Later on, views can use the window manager to create a matching
|
||||
/// child view and store it in a container.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public TViewModel CreateViewModel<TViewModel>() where TViewModel : class {
|
||||
return (TViewModel)CreateInstance(typeof(TViewModel));
|
||||
}
|
||||
|
||||
/// <summary>Locates the view that will be used to a view model</summary>
|
||||
/// <param name="viewModelType">
|
||||
/// Type of view model for which the view will be located
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue