NavigationDialogHost class

Namespace Runic.Navigation.Wpf · Runic.Navigation.Wpf 0.7.0-preview.5

public class NavigationDialogHost : FrameworkElement

Inherits or implements FrameworkElement.

Shows each entry of a dialog region in its own owned window: a zero-size element to place in the owner window.

Remarks

The host shows one window per entry in the region's stack, each owned by the window below it and the bottom one by the host's window. Windows are shown with Window.Show, never Window.ShowDialog, so the host never runs a nested message pump. It emulates modality instead: see NavigationDialogHost.Modality.

A dialog completes through its entry (CompleteAsync or DismissAsync), never through Window.DialogResult, which throws on a window shown with Window.Show, and never through IsCancel or IsDefault buttons. Closing a dialog window (the close button, Alt+F4 or, with NavigationDialogHost.CloseOnEscape, Esc) goes back in the region, or clears it from its bottom entry; a guard may veto it, and the window stays open. The host never cancels its owner's close: the dialogs close with the owner, and the host clears the region once.

Constructors

NavigationDialogHost

public NavigationDialogHost()

Creates a dialog host.

Fields

CloseOnEscapeProperty

public static readonly DependencyProperty CloseOnEscapeProperty

Identifies the NavigationDialogHost.CloseOnEscape dependency property.

ModalityProperty

public static readonly DependencyProperty ModalityProperty

Identifies the NavigationDialogHost.Modality dependency property.

RegionProperty

public static readonly DependencyProperty RegionProperty

Identifies the NavigationDialogHost.Region dependency property.

ViewLocatorProperty

public static readonly DependencyProperty ViewLocatorProperty

Identifies the NavigationDialogHost.ViewLocator dependency property.

WindowStyleProperty

public static readonly DependencyProperty WindowStyleProperty

Identifies the NavigationDialogHost.WindowStyle dependency property.

Properties

CloseOnEscape

public bool CloseOnEscape { get; set; }

Gets or sets whether Esc in a dialog window closes it like its close button. The default is true.

Modality

public NavigationDialogModality Modality { get; set; }

Gets or sets what the host disables while the region has dialog windows. The default, NavigationDialogModality.Application, disables every other top-level window of the UI thread.

Remarks

Each dialog window disables what it finds when it opens, through a refcount shared by all dialog hosts of the thread: a window that something else disabled is left alone and stays disabled. The windows are re-enabled before the dialog above them closes, so the owner is activated next. A change applies to dialogs opened afterwards.

Region

public INavigationRegion? Region { get; set; }

Gets or sets the dialog region.

ViewLocator

public INavigationViewLocator? ViewLocator { get; set; }

Gets or sets the locator asked first for each entry's view.

WindowStyle

public Style? WindowStyle { get; set; }

Gets or sets the style of each dialog window, for its title and chrome. Unless the style sets them, a dialog window sizes to its content and isn't shown in the taskbar. Dialog windows are centered on their owner.