MessageBox Width

Aug 27, 2012 at 9:00 PM
Edited Aug 27, 2012 at 9:02 PM

How do you change the width of the MessageBox Control so that the width is smaller than default? I have tried:


<Setter Property="Panel.Width" Value="50" />
<Setter Property="Grid.Width" Value="50" />
<Setter Property="DockPanel.Width" Value="50" />
<Setter Property="Width" Value="50" />
<Setter Property="FrameworkElement.Width" Value="50"  
None of these work—I can make the width larger, but not smaller.
Aug 28, 2012 at 3:59 PM

The following is specified in the MessageBox' default style:

      <Setter Property="MinWidth" Value="350" />
      <Setter Property="MinHeight" Value="50" />
      <Setter Property="MaxHeight" Value="250" />

Try to style the MessageBox with a "MinWidth" that is under or equal to your "Width".

Beware that there is a lot of hardcoded widths and heights winthin the MessageBox template. Sub elements may not appear correctly if you force an incompatible Width or Height