Xceed.Wpf.Toolkit.MessageBox.Button_Click C# (CSharp) Method

Button_Click() private method

Sets the MessageBoxResult according to the button pressed and then closes the MessageBox.
private Button_Click ( object sender, RoutedEventArgs e ) : void
sender object The source of the event.
e System.Windows.RoutedEventArgs The instance containing the event data.
return void
    private void Button_Click( object sender, RoutedEventArgs e )
    {
      Button button = e.OriginalSource as Button;

      if( button == null )
        return;

      switch( button.Name )
      {
        case PART_NoButton:
          _dialogResult = MessageBoxResult.No;
          this.Close();
          break;
        case PART_YesButton:
          _dialogResult = MessageBoxResult.Yes;
          this.Close();
          break;
        case PART_CancelButton:
          _dialogResult = MessageBoxResult.Cancel;
          this.Close();
          break;
        case PART_OkButton:
          _dialogResult = MessageBoxResult.OK;
          this.Close();
          break;
      }

      e.Handled = true;
    }