Table of Contents

Class DialogHostEx

Namespace
HeBianGu.Control.Message
Assembly
HeBianGu.Control.Message.dll

Helper extensions for showing dialogs.

public static class DialogHostEx
Inheritance
DialogHostEx
Inherited Members

Methods

ShowDialog(DependencyObject, object)

Shows a dialog using the parent/ancestor DialogHost of the a given DependencyObject.

public static Task<object> ShowDialog(this DependencyObject childDependencyObject, object content)

Parameters

childDependencyObject DependencyObject

Dependency object which should be a visual child of a DialogHost, where the dialog will be shown.

content object

Content to show (can be a control or view model).

Returns

Task<object>

Exceptions

InvalidOperationException

Thrown is a DialogHost is not found when conducting a depth first traversal of visual tree.

ShowDialog(DependencyObject, object, DialogClosingEventHandler)

Shows a dialog using the parent/ancestor DialogHost of the a given DependencyObject.

public static Task<object> ShowDialog(this DependencyObject childDependencyObject, object content, DialogClosingEventHandler closingEventHandler)

Parameters

childDependencyObject DependencyObject

Dependency object which should be a visual child of a DialogHost, where the dialog will be shown.

content object

Content to show (can be a control or view model).

closingEventHandler DialogClosingEventHandler

Allows access to closing event which would otherwise have been subscribed to on a instance.

Returns

Task<object>

Exceptions

InvalidOperationException

Thrown is a DialogHost is not found when conducting a depth first traversal of visual tree.

ShowDialog(DependencyObject, object, DialogOpenedEventHandler)

Shows a dialog using the parent/ancestor DialogHost of the a given DependencyObject.

public static Task<object> ShowDialog(this DependencyObject childDependencyObject, object content, DialogOpenedEventHandler openedEventHandler)

Parameters

childDependencyObject DependencyObject

Dependency object which should be a visual child of a DialogHost, where the dialog will be shown.

content object

Content to show (can be a control or view model).

openedEventHandler DialogOpenedEventHandler

Allows access to opened event which would otherwise have been subscribed to on a instance.

Returns

Task<object>

Exceptions

InvalidOperationException

Thrown is a DialogHost is not found when conducting a depth first traversal of visual tree.

ShowDialog(DependencyObject, object, DialogOpenedEventHandler, DialogClosingEventHandler)

Shows a dialog using the parent/ancestor DialogHost of the a given DependencyObject.

public static Task<object> ShowDialog(this DependencyObject childDependencyObject, object content, DialogOpenedEventHandler openedEventHandler, DialogClosingEventHandler closingEventHandler)

Parameters

childDependencyObject DependencyObject

Dependency object which should be a visual child of a DialogHost, where the dialog will be shown.

content object

Content to show (can be a control or view model).

openedEventHandler DialogOpenedEventHandler

Allows access to opened event which would otherwise have been subscribed to on a instance.

closingEventHandler DialogClosingEventHandler

Allows access to closing event which would otherwise have been subscribed to on a instance.

Returns

Task<object>

Exceptions

InvalidOperationException

Thrown is a DialogHost is not found when conducting a depth first traversal of visual tree.

ShowDialog(Window, object)

Shows a dialog using the first found DialogHost in a given Window.

public static Task<object> ShowDialog(this Window window, object content)

Parameters

window Window

Window on which the modal dialog should be displayed. Must contain a DialogHost.

content object

Returns

Task<object>

Remarks

As a depth first traversal of the window's visual tree is performed, it is not safe to use this method in a situtation where a screen has multiple DialogHosts.

Exceptions

InvalidOperationException

Thrown is a DialogHost is not found when conducting a depth first traversal of visual tree.

ShowDialog(Window, object, DialogClosingEventHandler)

Shows a dialog using the first found DialogHost in a given Window.

public static Task<object> ShowDialog(this Window window, object content, DialogClosingEventHandler closingEventHandler)

Parameters

window Window

Window on which the modal dialog should be displayed. Must contain a DialogHost.

content object

Content to show (can be a control or view model).

closingEventHandler DialogClosingEventHandler

Allows access to closing event which would otherwise have been subscribed to on a instance.

Returns

Task<object>

Remarks

As a depth first traversal of the window's visual tree is performed, it is not safe to use this method in a situtation where a screen has multiple DialogHosts.

Exceptions

InvalidOperationException

Thrown is a DialogHost is not found when conducting a depth first traversal of visual tree.

ShowDialog(Window, object, DialogOpenedEventHandler)

Shows a dialog using the first found DialogHost in a given Window.

public static Task<object> ShowDialog(this Window window, object content, DialogOpenedEventHandler openedEventHandler)

Parameters

window Window

Window on which the modal dialog should be displayed. Must contain a DialogHost.

content object

Content to show (can be a control or view model).

openedEventHandler DialogOpenedEventHandler

Allows access to opened event which would otherwise have been subscribed to on a instance.

Returns

Task<object>

Remarks

As a depth first traversal of the window's visual tree is performed, it is not safe to use this method in a situtation where a screen has multiple DialogHosts.

Exceptions

InvalidOperationException

Thrown is a DialogHost is not found when conducting a depth first traversal of visual tree.

ShowDialog(Window, object, DialogOpenedEventHandler, DialogClosingEventHandler)

Shows a dialog using the first found DialogHost in a given Window.

public static Task<object> ShowDialog(this Window window, object content, DialogOpenedEventHandler openedEventHandler, DialogClosingEventHandler closingEventHandler)

Parameters

window Window

Window on which the modal dialog should be displayed. Must contain a DialogHost.

content object

Content to show (can be a control or view model).

openedEventHandler DialogOpenedEventHandler

Allows access to opened event which would otherwise have been subscribed to on a instance.

closingEventHandler DialogClosingEventHandler

Allows access to closing event which would otherwise have been subscribed to on a instance.

Returns

Task<object>

Remarks

As a depth first traversal of the window's visual tree is performed, it is not safe to use this method in a situtation where a screen has multiple DialogHosts.

Exceptions

InvalidOperationException

Thrown is a DialogHost is not found when conducting a depth first traversal of visual tree.