Advertisement
Guest User

Style for dual header groupbox

a guest
May 31st, 2011
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 4.91 KB | None | 0 0
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2.                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3.                    xmlns:ctl="clr-namespace:Velib.Controls"
  4.                    xmlns:conv="clr-namespace:Velib.Converters">
  5.  
  6.     <Style TargetType="{x:Type ctl:DualHeaderGroupBox}">
  7.  
  8.         <Setter Property="BorderBrush" Value="#D5DFE5" />
  9.         <Setter Property="BorderThickness" Value="1" />
  10.  
  11.         <Setter Property="Template">
  12.             <Setter.Value>
  13.  
  14.                 <ControlTemplate TargetType="{x:Type ctl:DualHeaderGroupBox}">
  15.                     <ControlTemplate.Resources>
  16.                         <conv:DualBorderGapMaskConverter x:Key="DualBorderGapMaskConverter" />
  17.                     </ControlTemplate.Resources>
  18.  
  19.                     <Grid SnapsToDevicePixels="True">
  20.  
  21.                         <Grid.RowDefinitions>
  22.                             <RowDefinition Height="Auto"/>
  23.                             <RowDefinition Height="Auto"/>
  24.                             <RowDefinition Height="*"/>
  25.                             <RowDefinition Height="6"/>
  26.                         </Grid.RowDefinitions>
  27.  
  28.                         <Grid.ColumnDefinitions>
  29.                             <ColumnDefinition Width="6"/>
  30.                             <ColumnDefinition Width="Auto"/>
  31.                             <ColumnDefinition Width="*"/>
  32.                             <ColumnDefinition Width="Auto"/>
  33.                             <ColumnDefinition Width="6"/>
  34.                         </Grid.ColumnDefinitions>
  35.  
  36.                         <Border Grid.Row="1" Grid.Column="0"
  37.                                Grid.RowSpan="3" Grid.ColumnSpan="5"
  38.                                CornerRadius="4"
  39.                                Background="{TemplateBinding Background}"
  40.                                BorderBrush="Transparent"
  41.                                BorderThickness="{TemplateBinding BorderThickness}"/>
  42.  
  43.                         <Border Name="LeftHeader"
  44.                                Grid.Row="0" Grid.Column="1"
  45.                                Grid.RowSpan="2"
  46.                                HorizontalAlignment="Left"
  47.                                Padding="3,1,3,0">
  48.                             <ContentPresenter ContentSource="LeftHeader"
  49.                                              RecognizesAccessKey="true"
  50.                                              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
  51.                         </Border>
  52.  
  53.                         <Border Name="RightHeader"
  54.                                Grid.Row="0" Grid.Column="3"
  55.                                Grid.RowSpan="2"
  56.                                HorizontalAlignment="Right"
  57.                                Padding="3,1,3,0">
  58.                             <ContentPresenter ContentSource="RightHeader"
  59.                                              RecognizesAccessKey="true"
  60.                                              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
  61.                         </Border>
  62.  
  63.                         <ContentPresenter Grid.Row="2" Grid.Column="1"
  64.                                          Grid.ColumnSpan="3"
  65.                                          Margin="{TemplateBinding Padding}"
  66.                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  67.  
  68.                         <Border Grid.Row="1"
  69.                                Grid.RowSpan="3" Grid.ColumnSpan="5"
  70.                                CornerRadius="4"
  71.                                BorderThickness="{TemplateBinding BorderThickness}"
  72.                                BorderBrush="White"
  73.                                IsHitTestVisible="False">
  74.                             <Border.OpacityMask>
  75.                                 <MultiBinding Converter="{StaticResource DualBorderGapMaskConverter}" ConverterParameter="7">
  76.                                     <Binding ElementName="LeftHeader" Path="ActualWidth" />
  77.                                     <Binding ElementName="RightHeader" Path="ActualWidth" />
  78.                                     <Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}" />
  79.                                     <Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}" />
  80.                                 </MultiBinding>
  81.                             </Border.OpacityMask>
  82.                             <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="3">
  83.                                 <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="White" CornerRadius="2" />
  84.                             </Border>
  85.                         </Border>
  86.  
  87.                     </Grid>
  88.  
  89.                 </ControlTemplate>
  90.  
  91.             </Setter.Value>
  92.         </Setter>
  93.     </Style>
  94.  
  95. </ResourceDictionary>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement