Which GroupBox control would you recommend for Silverlight? [closed]
It seems like everyone has their开发者_如何学C own GroupBox control for Silverlight. Which one would you recommend.
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>
Hi I am using Contrib Silvelight... the controls function very well and there are free.
The site is: http://silverlightcontrib.codeplex.com/
You only need to download the binaries libraries Binaries - Silverlight Contrib 2010.1.0 and add the dll's as reference in your silverlight project.
精彩评论