#893 – Creating a GroupBox with a Border But No Header
August 27, 2013 2 Comments
There are cases where you might want a GroupBox for grouping a set of child controls, but without the associated header text. If you try just omitting the Header, but you’ll see a little gap at the top of the GroupBox.
To remove the gap you could just use a Border element instead of a GroupBox, changing its style to match the GroupBox. You can also edit the default style of the GroupBox.
To edit the style of the GroupBox, start by right-clicking the GroupBox control in Visual Studio and select Edit Template, Edit a Copy.
Accept the default name for the style.
Within the Style element, find the OpacityMask, near the bottom, and comment it out.
Note that your GroupBox element is now using your modified copy of the style.
<GroupBox Margin="10" BorderBrush="DarkGray" Style="{DynamicResource GroupBoxStyle1}">
The GroupBox will no longer have the little gap where the header should go.
Pingback: Dew Drop – August 27, 2013 (#1,612) | Alvin Ashcraft's Morning Dew
not workking for me… my code has no borderOpacticy or MutiBinding and it stills with that blank gap. could you please help me?