public class ViewHost : Decorator Presents plain borrowed content through view location or an implicit WPF DataTemplate.
Remarks
The host creates a fresh presentation when content changes or the host reloads. It never owns or disposes content, creates navigation entries, or changes navigation. Its Child is managed by the host. The host's ViewLocator is asked first, then the locator from Services, then implicit WPF templates. Entry-specific locators can implement the plain-content overload for use with this host.
Constructors
ViewHost
public ViewHost() Creates a plain-content view host.
Fields
ContentProperty
public static readonly DependencyProperty ContentProperty Identifies the Content dependency property.
ServicesProperty
public static readonly DependencyProperty ServicesProperty Identifies the Services attached dependency property, which descendants inherit.
Remarks
RunicViewHost in Runic.Application.Views.Wpf shares this property, so one provider set on a window reaches both hosts.
ViewLocatorProperty
public static readonly DependencyProperty ViewLocatorProperty Identifies the ViewLocator dependency property.
Properties
Content
public object? Content { get; set; } Gets or sets the borrowed content to present.
Services
public IServiceProvider? Services { get; set; } Gets or sets the provider for registered view location and view construction.
Remarks
Inherited: set it once on the window with ViewHost.SetServices, or on the host. The caller owns this provider. Without one, only the explicit locator and implicit templates are available.
ViewLocator
public INavigationViewLocator? ViewLocator { get; set; } Gets or sets the locator asked first for a plain-content view.
Methods
GetServices
public static IServiceProvider? GetServices(DependencyObject element) Gets the provider set on element, or inherited from its ancestors.
Parameters
elementThe element, such as a window.
Returns
The provider, or null.
SetServices
public static void SetServices(DependencyObject element, IServiceProvider? services) Sets the provider for every host element contains, such as a window.
Parameters
elementThe element, such as a window.
servicesThe provider, or
nullto clear it.