Skip to content

ViewLocatorAttribute class

Applied to a view model to declare which view renders it and how the hosting window should look. The window services read this attribute when a view model is shown, create the view and put it in Content, so the view model never has to construct its own view.

[AttributeUsage(AttributeTargets.Class)]
public class ViewLocatorAttribute : Attribute

Public Members

name description
ViewLocatorAttribute(…) Declares the view for the annotated view model, leaving the hosting window with its default style classes. (2 constructors)
StyleClasses { get; set; } The style classes applied to the hosting window, as a single space-separated string. Defaults to "DefaultDialogWindow", and is null when the classes were supplied as an array instead. See DialogWindowClasses for the recognised names.
StyleClassesArray { get; } The style classes applied to the hosting window, one per element. Set only by the constructor that takes them separately; otherwise null.
ViewType { get; } The type of the view created for the annotated view model. It must have a parameterless constructor.

See Also