private InteractionDialogBase GetDialog(Notification notification) { InteractionDialogBase dialog = this.Dialog; dialog.DataContext = notification; dialog.MessageTemplate = this.ContentTemplate; dialog.SetValue( Grid.RowSpanProperty, this.AssociatedObject.RowDefinitions.Count == 0 ? 1 : this.AssociatedObject.RowDefinitions.Count); dialog.SetValue( Grid.ColumnSpanProperty, this.AssociatedObject.ColumnDefinitions.Count == 0 ? 1 : this.AssociatedObject.ColumnDefinitions.Count); this.AssociatedObject.Children.Add(dialog); return(dialog); }
protected override void Invoke(object parameter) { var args = parameter as InteractionRequestedEventArgs; if (args == null) { return; } InteractionDialogBase dialog = this.GetDialog(args.Context); Action callback = args.Callback; EventHandler handler = null; handler = (s, e) => { dialog.Closed -= handler; this.AssociatedObject.Children.Remove(dialog); callback(); }; dialog.Closed += handler; }