Xceed Toolkit Plus for WPF v4.6 Documentation
MessageBox Class
Members  Example 


Xceed.Wpf.Toolkit Assembly > Xceed.Wpf.Toolkit Namespace : MessageBox Class
Represents a message box that has a message and that returns a result.
Syntax
'Declaration
 
<TemplateVisualStateAttribute(Name="OK", GroupName="MessageBoxButtonsGroup")>
<TemplatePartAttribute(Name="PART_CancelButton", Type=System.Windows.Controls.Button)>
<DefaultPropertyAttribute("Content")>
<ContentPropertyAttribute("Content")>
<LocalizabilityAttribute(LocalizationCategory.None, Readability=Readability.Unreadable)>
<StyleTypedPropertyAttribute(Property="FocusVisualStyle", StyleTargetType=System.Windows.Controls.Control)>
<XmlLangPropertyAttribute("Language")>
<UsableDuringInitializationAttribute(True)>
<RuntimeNamePropertyAttribute("Name")>
<UidPropertyAttribute("Uid")>
<TypeDescriptionProviderAttribute(MS.Internal.ComponentModel.DependencyObjectProvider)>
<NameScopePropertyAttribute("NameScope", System.Windows.NameScope)>
Public Class MessageBox 
   Inherits Xceed.Wpf.Toolkit.Primitives.WindowControl
'Usage
 
Dim instance As MessageBox
[TemplateVisualState(Name="OK", GroupName="MessageBoxButtonsGroup")]
[TemplatePart(Name="PART_CancelButton", Type=System.Windows.Controls.Button)]
[DefaultProperty("Content")]
[ContentProperty("Content")]
[Localizability(LocalizationCategory.None, Readability=Readability.Unreadable)]
[StyleTypedProperty(Property="FocusVisualStyle", StyleTargetType=System.Windows.Controls.Control)]
[XmlLangProperty("Language")]
[UsableDuringInitialization(true)]
[RuntimeNameProperty("Name")]
[UidProperty("Uid")]
[TypeDescriptionProvider(MS.Internal.ComponentModel.DependencyObjectProvider)]
[NameScopeProperty("NameScope", System.Windows.NameScope)]
public class MessageBox : Xceed.Wpf.Toolkit.Primitives.WindowControl 
Remarks

Starting with version 2.0, MessageBox (and ChildWindow) is derived from WindowControl and no longer manages its parent’s background or the positioning of itself based on its parent’s size.

WindowContainer should now be used to contain these controls. It provides an area where WindowControl-derived controls (ChildWindow or MessageBox controls) can be displayed. This is particularly interesting in an XBAP application where windows can't be popped up. In this case the WindowContainer can be sized to fit the application and the window-like control can be moved around in the WindowContainer.

The WindowContainer derives from Canvas and positions its children according to its size. Many actions performed on its children are managed by the WindowContainer (movement and positioning, resizing, visibility, modal, and mouse click). This will restrict the WindowControl movements and resizing to the WindowContainer’s size.

When no Width and Height are specified in the WindowContainer, its DesiredSize will be the size of its biggest child.

Example
The following example shows how to use a MessageBox and a ChildWindow.
<xctk:WindowContainer>
  <xctk:ChildWindow WindowBackground="Blue"
                    Left="75"
                    Top="50"
                    Width="275"
                    Height="125"
                    WindowState="Open">
    <TextBlock Text="This is a Child Window" Padding="10"/>
  </xctk:ChildWindow>

  <xctk:ChildWindow WindowBackground="Green"
                    Left="175"
                    Top="125"
                    Width="275"
                    Height="125"
                    WindowState="Open">
    <TextBlock Text="This is another Child Window" Padding="10"/>
  </xctk:ChildWindow>

  <xctk:MessageBox Caption="MessageBox"
                   Text="This is a MessageBox"/>
</xctk:WindowContainer>
Inheritance Hierarchy

System.Object
   System.Windows.Threading.DispatcherObject
      System.Windows.DependencyObject
         System.Windows.Media.Visual
            System.Windows.UIElement
               System.Windows.FrameworkElement
                  System.Windows.Controls.Control
                     System.Windows.Controls.ContentControl
                        Xceed.Wpf.Toolkit.Primitives.WindowControl
                           Xceed.Wpf.Toolkit.MessageBox

Requirements

Target Platforms: Windows 11, Windows 10, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

MessageBox Members
Xceed.Wpf.Toolkit Namespace