private void ExecuteButtonCommand(object sender, EventArgs e, DialogButton button) { if (button != null) { if (!string.IsNullOrEmpty(button.Command)) { ICommandCore command = ApplicationManager.Current.CommandStore[button.Command]; if (command != null) { if (command.CanExecute(null)) { command.Execute(null); } } } } DialogClosing(sender, e); }
public override void OnApplyTemplate() { base.OnApplyTemplate(); closeButtonElement = (Button) GetTemplateChild("CloseButtonElement"); closeButtonElement.Click += closeButtonElement_Click; firstButtonElement = (DialogButton) GetTemplateChild("FirstButtonElement"); firstButtonElement.Text = FirstButtonText; firstButtonElement.Command = FirstButtonCommand; firstButtonElement.Click += firstButtonElement_Click; secondButtonElement = (DialogButton) GetTemplateChild("SecondButtonElement"); secondButtonElement.Text = SecondButtonText; secondButtonElement.Command = SecondButtonCommand; secondButtonElement.Click += secondButtonElement_Click; thirdButtonElement = (DialogButton) GetTemplateChild("ThirdButtonElement"); thirdButtonElement.Text = ThirdButtonText; thirdButtonElement.Command = ThirdButtonCommand; thirdButtonElement.Click += thirdButtonElement_Click; //DialogButtonLayout = DialogButtonLayout; }