Thursday, August 2, 2012

WPF XAML GridSplitter Style


<Style x:Key="gridSplitterStyle" TargetType="{x:Type GridSplitter}">
    <Setter Property="FrameworkElement.Height" Value="6"/>
    <Setter Property="TextElement.Foreground" Value="#FF204D89" />
    <Setter Property="Border.BorderThickness" Value="0,0,0,0" />
    <Setter Property="UIElement.SnapsToDevicePixels" Value="True" />
    <Setter Property="UIElement.Focusable" Value="False" />
    <Setter Property="FrameworkElement.Cursor" Value="SizeNS" />
    <Setter Property="Control.Template">
        <Setter.Value>
            <ControlTemplate>
                    <Border BorderThickness="0,0,0,0" >
                        <Canvas Width="19" Height="3">
                            <Rectangle Fill="{TemplateBinding TextElement.Foreground}" Width="2" Height="2" Canvas.Left="0" Canvas.Top="0" />
                            <Rectangle Fill="{TemplateBinding TextElement.Foreground}" Width="2" Height="2" Canvas.Left="4" Canvas.Top="0" />
                            <Rectangle Fill="{TemplateBinding TextElement.Foreground}" Width="2" Height="2" Canvas.Left="8" Canvas.Top="0" />
                            <Rectangle Fill="{TemplateBinding TextElement.Foreground}" Width="2" Height="2" Canvas.Left="12" Canvas.Top="0" />
                            <Rectangle Fill="{TemplateBinding TextElement.Foreground}" Width="2" Height="2" Canvas.Left="16" Canvas.Top="0" />
                        </Canvas>
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

No comments:

Post a Comment