You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Shows a dialog using the first found <see cref="DialogHost"/> with the supplied dialog identifier in a given <see cref="Window"/>.
41
+
/// </summary>
42
+
/// <param name="window">Window on which the modal dialog should be displayed. Must contain a <see cref="DialogHost"/>.</param>
43
+
/// <param name="content">Content to show (can be a control or view model).</param>
44
+
/// <param name="dialogIdentifier"><see cref="Identifier"/> of the instance where the dialog should be shown. Typically this will match an identifier set in XAML. <c>null</c> is allowed.</param>
45
+
/// <returns>Task result is the parameter used to close the dialog, typically what is passed to the <see cref="CloseDialogCommand"/> command.</returns>
/// Shows a dialog using the parent/ancestor <see cref="DialogHost"/> of the a given <see cref="DependencyObject"/>.
114
+
/// </summary>
115
+
/// <param name="childDependencyObject">Dependency object which should be a visual child of a <see cref="DialogHost"/>, where the dialog will be shown.</param>
116
+
/// <param name="content">Content to show (can be a control or view model).</param>
117
+
/// <param name="dialogIdentifier"><see cref="Identifier"/> of the instance where the dialog should be shown. Typically this will match an identifier set in XAML. <c>null</c> is allowed.</param>
118
+
/// <exception cref="InvalidOperationException">
119
+
/// Thrown is a <see cref="DialogHost"/> is not found when conducting a depth first traversal of visual tree.
DialogHost?dialogHost=window.VisualDepthFirstTraversal().OfType<DialogHost>().FirstOrDefault(x =>x.Identifieris not null&&x.Identifier.Equals(dialogIdentifier));
197
+
198
+
if(dialogHostisnull)
199
+
thrownewInvalidOperationException($"Unable to find a DialogHost with identifier '{dialogIdentifier}' in visual tree");
DialogHost?dialogHost=childDependencyObject.GetVisualAncestry().OfType<DialogHost>().FirstOrDefault(x =>x.Identifieris not null&&x.Identifier.Equals(dialogIdentifier));
220
+
221
+
if(dialogHostisnull)
222
+
thrownewInvalidOperationException($"Unable to find a DialogHost in visual tree ancestry with identifier {dialogIdentifier}");
0 commit comments