| 123456789101112131415161718192021222324252627 |
- using System.Windows;
- namespace SHJX.Service.Common.ElementHelper
- {
- public static class DialogCloseHelper
- {
- public static readonly DependencyProperty DialogResultProperty =
- DependencyProperty.RegisterAttached(
- "DialogResult",
- typeof(bool?),
- typeof(DialogCloseHelper),
- new PropertyMetadata(DialogResultChanged));
- private static void DialogResultChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- if (d is Window window)
- {
- window.DialogResult = e.NewValue as bool?;
- }
- }
- public static void SetDialogResult(Window target, bool? value)
- {
- target.SetValue(DialogResultProperty, value);
- }
- }
- }
|