TodorMitev

CheckBoxStyleTemplate

Jun 14th, 2012
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 2.36 KB | None | 0 0
  1. <ResourceDictionary
  2.    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3.    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4.    xmlns:d="http://schemas.microsoft.com/expression/blend/2006"
  5.    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6.    mc:Ignorable="d" >
  7.  
  8.     <Style x:Key="CheckBoxStyle" TargetType="{x:Type CheckBox}">
  9.         <Setter Property="Foreground" Value="#15a1e2"/>
  10.         <Setter Property="VerticalAlignment" Value="Center" />
  11.         <Setter Property="Background" Value="#15a1e2"/>
  12.         <Setter Property="BorderBrush" Value="#15a1e2"/>
  13.         <Setter Property="Content" Value="{StaticResource Content}" />
  14.         <Setter Property="Template">
  15.             <Setter.Value>
  16.                
  17.                 <ControlTemplate TargetType="{x:Type CheckBox}">
  18.                     <StackPanel Orientation="Horizontal">
  19.                         <ContentPresenter Margin="0,0,5,0"/>
  20.                         <Border x:Name="Border"  
  21.                                  Width="15"
  22.                                  Height="15"
  23.                                  CornerRadius="0"
  24.                                  Background="Transparent"
  25.                                  BorderThickness="3"
  26.                                  BorderBrush="#15a1e2">
  27.                             <Path x:Name="CheckMark"
  28.                                  Data="M0.45370397,2.9789081 L4.8584409,5.1201844 L9.0095177,0.42685521 L9.0092859,5.1932764 L5.0808349,8.7450323 L0.49096614,6.3567581 z"
  29.                                  Fill="#15a1e2"
  30.                                  Stretch="Fill"
  31.                                  StrokeThickness="2"
  32.                                  UseLayoutRounding="False"
  33.                                  Visibility="Collapsed"
  34.                                  Margin="0.302,0.089,0.141,0.593"  />
  35.                         </Border>
  36.                     </StackPanel>
  37.                     <ControlTemplate.Triggers>
  38.                         <Trigger Property="IsChecked" Value="true">
  39.                             <Setter TargetName="CheckMark" Property="Visibility" Value="Visible" />
  40.                         </Trigger>
  41.                     </ControlTemplate.Triggers>
  42.                 </ControlTemplate>
  43.             </Setter.Value>
  44.         </Setter>
  45.     </Style>
  46. </ResourceDictionary>
Advertisement
Add Comment
Please, Sign In to add comment