开发者

Which GroupBox control would you recommend for Silverlight? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 10 years ago.

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:

Which GroupBox control would you recommend for Silverlight? [closed]

<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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜