Registering a View
Registering a view is quite simple: just like the view model, you export the view with a tag.
Exactly one view must be registered as the "shell" view by setting IsShell = true:
[ExportAsView("Shell",IsShell = true)]
public partial class Shell
If you choose, you may use a strongly-typed export that will default the view tag to the full type name of the view. A view called "MyView" in "MyProject" namespace "Views" will be exported with the tag "MyProject.Views.MyView":
[ExportAsView(typeof(MyView),IsShell = false)]
public partial class MyView
You may add additional meta data to a view to help with constructing navigation, filtering views, etc.
Additional tags include:
- use this to group views. For example, top level navigation views might be tagged "Main".
- use this to dynamically construct menu information and provide a user-friendly name for the view that may not match the tag
- use this to specify a detailed description of the view for use in tool tips and descriptions.
At runtime, you can get the metadata for a view using the IViewModelRouter (provided as Router in the base view model):
IExportAsViewMetadata metadata = Router.GetMetadataForView("MyViewTag");