Class DialogHostEx
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
DependencyObjectDependency object which should be a visual child of a DialogHost, where the dialog will be shown.
content
objectContent to show (can be a control or view model).
Returns
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
DependencyObjectDependency object which should be a visual child of a DialogHost, where the dialog will be shown.
content
objectContent to show (can be a control or view model).
closingEventHandler
DialogClosingEventHandlerAllows access to closing event which would otherwise have been subscribed to on a instance.
Returns
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
DependencyObjectDependency object which should be a visual child of a DialogHost, where the dialog will be shown.
content
objectContent to show (can be a control or view model).
openedEventHandler
DialogOpenedEventHandlerAllows access to opened event which would otherwise have been subscribed to on a instance.
Returns
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
DependencyObjectDependency object which should be a visual child of a DialogHost, where the dialog will be shown.
content
objectContent to show (can be a control or view model).
openedEventHandler
DialogOpenedEventHandlerAllows access to opened event which would otherwise have been subscribed to on a instance.
closingEventHandler
DialogClosingEventHandlerAllows access to closing event which would otherwise have been subscribed to on a instance.
Returns
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
WindowWindow on which the modal dialog should be displayed. Must contain a DialogHost.
content
object
Returns
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
WindowWindow on which the modal dialog should be displayed. Must contain a DialogHost.
content
objectContent to show (can be a control or view model).
closingEventHandler
DialogClosingEventHandlerAllows access to closing event which would otherwise have been subscribed to on a instance.
Returns
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
WindowWindow on which the modal dialog should be displayed. Must contain a DialogHost.
content
objectContent to show (can be a control or view model).
openedEventHandler
DialogOpenedEventHandlerAllows access to opened event which would otherwise have been subscribed to on a instance.
Returns
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
WindowWindow on which the modal dialog should be displayed. Must contain a DialogHost.
content
objectContent to show (can be a control or view model).
openedEventHandler
DialogOpenedEventHandlerAllows access to opened event which would otherwise have been subscribed to on a instance.
closingEventHandler
DialogClosingEventHandlerAllows access to closing event which would otherwise have been subscribed to on a instance.
Returns
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.