protected void ShowDialog(DialogUserControlBase dialog) { if (DialogContainer == null) { Panel layoutRoot = this.FindName("LayoutRoot") as Panel; if (layoutRoot == null) { throw new InvalidOperationException("Could not automatically create dialog container."); } ContentPresenter dialogContainer = new ContentPresenter(); layoutRoot.Children.Add(dialogContainer); Grid.SetColumnSpan(dialogContainer, int.MaxValue); Grid.SetRowSpan(dialogContainer, int.MaxValue); DialogContainer = dialogContainer; } if (IsDialogOpen) { return; } _currentDialogControl = dialog; _currentDialogControl.Closed += Dialog_Closed; _currentDialogControl.Show(DialogContainer); }
private void Dialog_Closed(object sender, DialogControlClosedEventArgs e) { if (_currentDialogControl == sender) { _currentDialogControl = null; DialogClosed.Raise(sender, e); } }