It seems like everyone has their own GroupBox control for Silverlight. Which one would you recommend.
+1
A:
You could just stick with a regular HeaderedContentControl from the Silverlight Toolkit and style it to look like a group box:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
xmlns:t="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit">
<Style x:Key="GroupBox" TargetType="t:HeaderedContentControl">
<Setter Property="BorderBrush" Value="LightGray" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Background" Value="White" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
<Setter Property="Padding" Value="4" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="t:HeaderedContentControl">
<Grid Background="{TemplateBinding Background}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4"
Margin="0,8,0,0"
Grid.RowSpan="2" />
<s:Label Background="{TemplateBinding Background}"
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}"
HorizontalAlignment="Left"
Margin="8,0,0,0"
Grid.Row="0" />
<ContentPresenter Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding Padding}"
Grid.Row="1" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
Josh Einstein
2010-07-12 23:23:14
That's close enough for me. But why didn't they just use the normal name for that kind of control?
Jonathan Allen
2010-07-12 23:38:49
I guess cause they're ugly and Silverlight wanted a fresh start. :) WPF has a GroupBox though.
Josh Einstein
2010-07-13 05:40:26
Which is just as ugly before it's styled.
Jonathan Allen
2010-07-13 07:54:31
Right, I just meant that even though it's ugly it still seems like it should be there if for no other reason than parity with WPF.
Josh Einstein
2010-07-13 13:59:50