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

ShowMessageBox() public method

Displays this message box when embedded in a WindowContainer parent. Note that this call is not blocking and that you must register to the Closed event in order to handle the dialog result, if any.
public ShowMessageBox ( ) : void
return void
    public void ShowMessageBox()
    {
      if( this.Container != null || this.Parent == null )
        throw new InvalidOperationException(
          "This method is not intended to be called while displaying a MessageBox outside of a WindowContainer. Use ShowDialog() instead in that case." );

      if( !( this.Parent is WindowContainer ) )
        throw new InvalidOperationException(
          "The MessageBox instance is not intended to be displayed in a container other than a WindowContainer." );

      _dialogResult = System.Windows.MessageBoxResult.None;
      this.Visibility = Visibility.Visible;
    }

Same methods

MessageBox::ShowMessageBox ( string messageText ) : void
MessageBox::ShowMessageBox ( string messageText, string caption ) : void
MessageBox::ShowMessageBox ( string messageText, string caption, MessageBoxButton button ) : void
MessageBox::ShowMessageBox ( string messageText, string caption, MessageBoxButton button, MessageBoxImage icon ) : void
MessageBox::ShowMessageBox ( string messageText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult ) : void

Usage Example

示例#1
0
 private void ShowMessageBox(string text, string caption, MessageBoxButton button = MessageBoxButton.OK,
                             MessageBoxImage icon    = MessageBoxImage.None, MessageBoxResult defaultResult = MessageBoxResult.None,
                             MessageType specialType = MessageType.None)
 {
     Xceed.Wpf.Toolkit.MessageBox popup = new Xceed.Wpf.Toolkit.MessageBox();
     popup.CaptionForeground = gray;
     popup.Closed           += MessagePopup_Closed;
     popup.Closed           += PopupClosed;
     popup.Resources["type"] = specialType;
     DialogArea.Children.Add(popup);
     popup.ShowMessageBox(text, caption, button, icon, defaultResult);
 }