locked
CheckBox and its text. RRS feed

  • Question

  • Hi,

     

    I have a simple problem.  When the CheckBox property IsEnabled is set to false.  CheckBox is greyed out, however the text stays the same without the greyed out effect like on the buttons lets say.

    How can I achieve that effect on the text of the CheckBox that the user can have an easier way of telling that the CheckBox is disabled?

     

    Thank you.

    Sunday, June 12, 2011 3:34 PM

Answers

  • Hi zaboboa,

    Below is the modified style, you can change opacity value of ContentPresenter in Disabled VisualState.

    <ControlTemplate x:Key="ValidationToolTipTemplate">
       <Grid x:Name="Root" Margin="5,0" Opacity="0" RenderTransformOrigin="0,0">
        <Grid.RenderTransform>
         <TranslateTransform x:Name="xform" X="-25"/>
        </Grid.RenderTransform>
        <VisualStateManager.VisualStateGroups>
         <VisualStateGroup x:Name="OpenStates">
          <VisualStateGroup.Transitions>
           <VisualTransition GeneratedDuration="0"/>
           <VisualTransition GeneratedDuration="0:0:0.2" To="Open">
            <Storyboard>
             <DoubleAnimation Duration="0:0:0.2" To="0" Storyboard.TargetProperty="X" Storyboard.TargetName="xform">
              <DoubleAnimation.EasingFunction>
               <BackEase Amplitude=".3" EasingMode="EaseOut"/>
              </DoubleAnimation.EasingFunction>
             </DoubleAnimation>
             <DoubleAnimation Duration="0:0:0.2" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root"/>
            </Storyboard>
           </VisualTransition>
          </VisualStateGroup.Transitions>
          <VisualState x:Name="Closed">
           <Storyboard>
            <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root"/>
           </Storyboard>
          </VisualState>
          <VisualState x:Name="Open">
           <Storyboard>
            <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="X" Storyboard.TargetName="xform"/>
            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root"/>
           </Storyboard>
          </VisualState>
         </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <Border Background="#052A2E31" CornerRadius="5" Margin="4,4,-4,-4"/>
        <Border Background="#152A2E31" CornerRadius="4" Margin="3,3,-3,-3"/>
        <Border Background="#252A2E31" CornerRadius="3" Margin="2,2,-2,-2"/>
        <Border Background="#352A2E31" CornerRadius="2" Margin="1,1,-1,-1"/>
        <Border Background="#FFDC000C" CornerRadius="2"/>
        <Border CornerRadius="2">
         <TextBlock Foreground="White" MaxWidth="250" Margin="8,4,8,4" TextWrapping="Wrap" Text="{Binding (Validation.Errors)[0].ErrorContent}" UseLayoutRounding="false"/>
        </Border>
       </Grid>
      </ControlTemplate>
      <Style x:Key="CheckBoxStyle1" TargetType="CheckBox">
       <Setter Property="Background" Value="#FF448DCA"/>
       <Setter Property="Foreground" Value="#FF000000"/>
       <Setter Property="HorizontalContentAlignment" Value="Left"/>
       <Setter Property="VerticalContentAlignment" Value="Top"/>
       <Setter Property="Padding" Value="4,1,0,0"/>
       <Setter Property="BorderThickness" Value="1"/>
       <Setter Property="BorderBrush">
        <Setter.Value>
         <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
          <GradientStop Color="#FFA3AEB9" Offset="0"/>
          <GradientStop Color="#FF8399A9" Offset="0.375"/>
          <GradientStop Color="#FF718597" Offset="0.375"/>
          <GradientStop Color="#FF617584" Offset="1"/>
         </LinearGradientBrush>
        </Setter.Value>
       </Setter>
       <Setter Property="Template">
        <Setter.Value>
         <ControlTemplate TargetType="CheckBox">
          <Grid>
           <Grid.ColumnDefinitions>
            <ColumnDefinition Width="16"/>
            <ColumnDefinition Width="*"/>
           </Grid.ColumnDefinitions>
           <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="CommonStates">
             <VisualState x:Name="Normal"/>
             <VisualState x:Name="MouseOver">
              <Storyboard>
               <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BackgroundOverlay"/>
               <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BoxMiddleBackground"/>
               <ColorAnimation Duration="0" To="#7FFFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
               <ColorAnimation Duration="0" To="#CCFFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
               <ColorAnimation Duration="0" To="#F2FFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
              </Storyboard>
             </VisualState>
             <VisualState x:Name="Pressed">
              <Storyboard>
               <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BackgroundOverlay"/>
               <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BoxMiddleBackground"/>
               <ColorAnimation Duration="0" To="#6BFFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
               <ColorAnimation Duration="0" To="#C6FFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
               <ColorAnimation Duration="0" To="#EAFFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
               <ColorAnimation Duration="0" To="#F4FFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
               <ColorAnimation Duration="0" To="#FF6DBDD1" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[3].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
               <ColorAnimation Duration="0" To="#FF6DBDD1" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
               <ColorAnimation Duration="0" To="#FF6DBDD1" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
               <ColorAnimation Duration="0" To="#FF6DBDD1" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[2].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
              </Storyboard>
             </VisualState>
             <VisualState x:Name="Disabled">
              <Storyboard>
               <DoubleAnimation Duration="0" To="0.4" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="contentPresenter"/>
               <DoubleAnimation Duration="0" To="0.55" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="DisabledVisualElement"/>
              </Storyboard>
             </VisualState>
            </VisualStateGroup>
            <VisualStateGroup x:Name="CheckStates">
             <VisualState x:Name="Checked">
              <Storyboard>
               <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="CheckIcon"/>
              </Storyboard>
             </VisualState>
             <VisualState x:Name="Unchecked"/>
             <VisualState x:Name="Indeterminate">
              <Storyboard>
               <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="IndeterminateIcon"/>
              </Storyboard>
             </VisualState>
            </VisualStateGroup>
            <VisualStateGroup x:Name="FocusStates">
             <VisualState x:Name="Focused">
              <Storyboard>
               <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ContentFocusVisualElement"/>
              </Storyboard>
             </VisualState>
             <VisualState x:Name="Unfocused"/>
            </VisualStateGroup>
            <VisualStateGroup x:Name="ValidationStates">
             <VisualState x:Name="Valid"/>
             <VisualState x:Name="InvalidUnfocused">
              <Storyboard>
               <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ValidationErrorElement">
                <DiscreteObjectKeyFrame KeyTime="0">
                 <DiscreteObjectKeyFrame.Value>
                  <Visibility>Visible</Visibility>
                 </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
               </ObjectAnimationUsingKeyFrames>
              </Storyboard>
             </VisualState>
             <VisualState x:Name="InvalidFocused">
              <Storyboard>
               <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ValidationErrorElement">
                <DiscreteObjectKeyFrame KeyTime="0">
                 <DiscreteObjectKeyFrame.Value>
                  <Visibility>Visible</Visibility>
                 </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
               </ObjectAnimationUsingKeyFrames>
               <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsOpen" Storyboard.TargetName="validationTooltip">
                <DiscreteObjectKeyFrame KeyTime="0">
                 <DiscreteObjectKeyFrame.Value>
                  <System:Boolean>True</System:Boolean>
                 </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
               </ObjectAnimationUsingKeyFrames>
              </Storyboard>
             </VisualState>
            </VisualStateGroup>
           </VisualStateManager.VisualStateGroups>
           <Grid HorizontalAlignment="Left" VerticalAlignment="Top">
            <Rectangle x:Name="Background" Fill="#FFFFFFFF" Height="14" Margin="1" RadiusY="1" RadiusX="1" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}" Width="14"/>
            <Rectangle x:Name="BackgroundOverlay" Fill="#FFC4DBEE" Height="14" Margin="1" Opacity="0" RadiusY="1" RadiusX="1" Stroke="#00000000" StrokeThickness="1" Width="14"/>
            <Rectangle x:Name="BoxMiddleBackground" Fill="{TemplateBinding Background}" Height="10" RadiusY="1" RadiusX="1" Stroke="#00000000" StrokeThickness="1" Width="10"/>
            <Rectangle x:Name="BoxMiddle" Height="10" RadiusY="1" RadiusX="1" StrokeThickness="1" Width="10">
             <Rectangle.Fill>
              <LinearGradientBrush EndPoint="0.64,0.88" StartPoint="0.62,0.15">
               <GradientStop Color="#FFFFFFFF" Offset="0.013"/>
               <GradientStop Color="#F9FFFFFF" Offset="0.375"/>
               <GradientStop Color="#EAFFFFFF" Offset="0.603"/>
               <GradientStop Color="#D8FFFFFF" Offset="1"/>
              </LinearGradientBrush>
             </Rectangle.Fill>
             <Rectangle.Stroke>
              <LinearGradientBrush EndPoint=".5,1" StartPoint=".5,0">
               <GradientStop Color="#FFFFFFFF" Offset="1"/>
               <GradientStop Color="#FFFFFFFF" Offset="0"/>
               <GradientStop Color="#FFFFFFFF" Offset="0.375"/>
               <GradientStop Color="#FFFFFFFF" Offset="0.375"/>
              </LinearGradientBrush>
             </Rectangle.Stroke>
            </Rectangle>
            <Rectangle x:Name="BoxMiddleLine" Height="10" Opacity=".2" RadiusY="1" RadiusX="1" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1" Width="10"/>
            <Path x:Name="CheckIcon" Data="M102.03442,598.79645 L105.22962,597.78918 L106.78825,600.42358 C106.78825,600.42358 108.51028,595.74304 110.21724,593.60419 C112.00967,591.35822 114.89314,591.42316 114.89314,591.42316 C114.89314,591.42316 112.67844,593.42645 111.93174,594.44464 C110.7449,596.06293 107.15683,604.13837 107.15683,604.13837 z" Fill="#FF333333" FlowDirection="LeftToRight" Height="10" Margin="1,1,0,1.5" Opacity="0" Stretch="Fill" Width="10.5"/>
            <Rectangle x:Name="IndeterminateIcon" Fill="#FF333333" Height="2" Opacity="0" Width="6"/>
            <Rectangle x:Name="DisabledVisualElement" Fill="#FFFFFFFF" Height="14" Opacity="0" RadiusY="1" RadiusX="1" Width="14"/>
            <Rectangle x:Name="ContentFocusVisualElement" Height="16" IsHitTestVisible="false" Opacity="0" RadiusY="2" RadiusX="2" Stroke="#FF6DBDD1" StrokeThickness="1" Width="16"/>
            <Border x:Name="ValidationErrorElement" BorderBrush="#FFDB000C" BorderThickness="1" CornerRadius="1" Margin="1" ToolTipService.PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Visibility="Collapsed">
             <ToolTipService.ToolTip>
              <ToolTip x:Name="validationTooltip" DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}" Placement="Right" PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Template="{StaticResource ValidationToolTipTemplate}">
               <ToolTip.Triggers>
                <EventTrigger RoutedEvent="Canvas.Loaded">
                 <BeginStoryboard>
                  <Storyboard>
                   <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsHitTestVisible" Storyboard.TargetName="validationTooltip">
                    <DiscreteObjectKeyFrame KeyTime="0">
                     <DiscreteObjectKeyFrame.Value>
                      <System:Boolean>true</System:Boolean>
                     </DiscreteObjectKeyFrame.Value>
                    </DiscreteObjectKeyFrame>
                   </ObjectAnimationUsingKeyFrames>
                  </Storyboard>
                 </BeginStoryboard>
                </EventTrigger>
               </ToolTip.Triggers>
              </ToolTip>
             </ToolTipService.ToolTip>
             <Grid Background="Transparent" HorizontalAlignment="Right" Height="10" Margin="0,-4,-4,0" VerticalAlignment="Top" Width="10">
              <Path Data="M 1,0 L5,0 A 2,2 90 0 1 7,2 L7,6 z" Fill="#FFDC000C" Margin="0,3,0,0"/>
              <Path Data="M 0,0 L2,0 L 7,5 L7,7" Fill="#ffffff" Margin="0,3,0,0"/>
             </Grid>
            </Border>
           </Grid>
           <ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="1" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
          </Grid>
         </ControlTemplate>
        </Setter.Value>
       </Setter>
      </Style>

     

    Best Regards,

    Sunday, June 19, 2011 11:07 AM

All replies

  • Attach a method to the IsEnabledChanged event in your CheckBox and put whatever you want to do with the text in that method. When the CheckBox is enabled or disabled, that method will be called.

    Sunday, June 12, 2011 3:43 PM
  • Can't wire it to a method.  Everything is done through binding, so there is no code behind.  There is a ViewModel, but that means I would have to duplicate code for every checkbox that I am using on the Ribbon.  There must be a solution through styles I think.

    Sunday, June 12, 2011 8:25 PM
  • Hi zaboboa,

    Below is the modified style, you can change opacity value of ContentPresenter in Disabled VisualState.

    <ControlTemplate x:Key="ValidationToolTipTemplate">
       <Grid x:Name="Root" Margin="5,0" Opacity="0" RenderTransformOrigin="0,0">
        <Grid.RenderTransform>
         <TranslateTransform x:Name="xform" X="-25"/>
        </Grid.RenderTransform>
        <VisualStateManager.VisualStateGroups>
         <VisualStateGroup x:Name="OpenStates">
          <VisualStateGroup.Transitions>
           <VisualTransition GeneratedDuration="0"/>
           <VisualTransition GeneratedDuration="0:0:0.2" To="Open">
            <Storyboard>
             <DoubleAnimation Duration="0:0:0.2" To="0" Storyboard.TargetProperty="X" Storyboard.TargetName="xform">
              <DoubleAnimation.EasingFunction>
               <BackEase Amplitude=".3" EasingMode="EaseOut"/>
              </DoubleAnimation.EasingFunction>
             </DoubleAnimation>
             <DoubleAnimation Duration="0:0:0.2" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root"/>
            </Storyboard>
           </VisualTransition>
          </VisualStateGroup.Transitions>
          <VisualState x:Name="Closed">
           <Storyboard>
            <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root"/>
           </Storyboard>
          </VisualState>
          <VisualState x:Name="Open">
           <Storyboard>
            <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="X" Storyboard.TargetName="xform"/>
            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root"/>
           </Storyboard>
          </VisualState>
         </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <Border Background="#052A2E31" CornerRadius="5" Margin="4,4,-4,-4"/>
        <Border Background="#152A2E31" CornerRadius="4" Margin="3,3,-3,-3"/>
        <Border Background="#252A2E31" CornerRadius="3" Margin="2,2,-2,-2"/>
        <Border Background="#352A2E31" CornerRadius="2" Margin="1,1,-1,-1"/>
        <Border Background="#FFDC000C" CornerRadius="2"/>
        <Border CornerRadius="2">
         <TextBlock Foreground="White" MaxWidth="250" Margin="8,4,8,4" TextWrapping="Wrap" Text="{Binding (Validation.Errors)[0].ErrorContent}" UseLayoutRounding="false"/>
        </Border>
       </Grid>
      </ControlTemplate>
      <Style x:Key="CheckBoxStyle1" TargetType="CheckBox">
       <Setter Property="Background" Value="#FF448DCA"/>
       <Setter Property="Foreground" Value="#FF000000"/>
       <Setter Property="HorizontalContentAlignment" Value="Left"/>
       <Setter Property="VerticalContentAlignment" Value="Top"/>
       <Setter Property="Padding" Value="4,1,0,0"/>
       <Setter Property="BorderThickness" Value="1"/>
       <Setter Property="BorderBrush">
        <Setter.Value>
         <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
          <GradientStop Color="#FFA3AEB9" Offset="0"/>
          <GradientStop Color="#FF8399A9" Offset="0.375"/>
          <GradientStop Color="#FF718597" Offset="0.375"/>
          <GradientStop Color="#FF617584" Offset="1"/>
         </LinearGradientBrush>
        </Setter.Value>
       </Setter>
       <Setter Property="Template">
        <Setter.Value>
         <ControlTemplate TargetType="CheckBox">
          <Grid>
           <Grid.ColumnDefinitions>
            <ColumnDefinition Width="16"/>
            <ColumnDefinition Width="*"/>
           </Grid.ColumnDefinitions>
           <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="CommonStates">
             <VisualState x:Name="Normal"/>
             <VisualState x:Name="MouseOver">
              <Storyboard>
               <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BackgroundOverlay"/>
               <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BoxMiddleBackground"/>
               <ColorAnimation Duration="0" To="#7FFFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
               <ColorAnimation Duration="0" To="#CCFFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
               <ColorAnimation Duration="0" To="#F2FFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
              </Storyboard>
             </VisualState>
             <VisualState x:Name="Pressed">
              <Storyboard>
               <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BackgroundOverlay"/>
               <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BoxMiddleBackground"/>
               <ColorAnimation Duration="0" To="#6BFFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
               <ColorAnimation Duration="0" To="#C6FFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
               <ColorAnimation Duration="0" To="#EAFFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
               <ColorAnimation Duration="0" To="#F4FFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
               <ColorAnimation Duration="0" To="#FF6DBDD1" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[3].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
               <ColorAnimation Duration="0" To="#FF6DBDD1" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
               <ColorAnimation Duration="0" To="#FF6DBDD1" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
               <ColorAnimation Duration="0" To="#FF6DBDD1" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[2].(GradientStop.Color)" Storyboard.TargetName="BoxMiddle"/>
              </Storyboard>
             </VisualState>
             <VisualState x:Name="Disabled">
              <Storyboard>
               <DoubleAnimation Duration="0" To="0.4" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="contentPresenter"/>
               <DoubleAnimation Duration="0" To="0.55" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="DisabledVisualElement"/>
              </Storyboard>
             </VisualState>
            </VisualStateGroup>
            <VisualStateGroup x:Name="CheckStates">
             <VisualState x:Name="Checked">
              <Storyboard>
               <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="CheckIcon"/>
              </Storyboard>
             </VisualState>
             <VisualState x:Name="Unchecked"/>
             <VisualState x:Name="Indeterminate">
              <Storyboard>
               <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="IndeterminateIcon"/>
              </Storyboard>
             </VisualState>
            </VisualStateGroup>
            <VisualStateGroup x:Name="FocusStates">
             <VisualState x:Name="Focused">
              <Storyboard>
               <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ContentFocusVisualElement"/>
              </Storyboard>
             </VisualState>
             <VisualState x:Name="Unfocused"/>
            </VisualStateGroup>
            <VisualStateGroup x:Name="ValidationStates">
             <VisualState x:Name="Valid"/>
             <VisualState x:Name="InvalidUnfocused">
              <Storyboard>
               <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ValidationErrorElement">
                <DiscreteObjectKeyFrame KeyTime="0">
                 <DiscreteObjectKeyFrame.Value>
                  <Visibility>Visible</Visibility>
                 </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
               </ObjectAnimationUsingKeyFrames>
              </Storyboard>
             </VisualState>
             <VisualState x:Name="InvalidFocused">
              <Storyboard>
               <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ValidationErrorElement">
                <DiscreteObjectKeyFrame KeyTime="0">
                 <DiscreteObjectKeyFrame.Value>
                  <Visibility>Visible</Visibility>
                 </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
               </ObjectAnimationUsingKeyFrames>
               <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsOpen" Storyboard.TargetName="validationTooltip">
                <DiscreteObjectKeyFrame KeyTime="0">
                 <DiscreteObjectKeyFrame.Value>
                  <System:Boolean>True</System:Boolean>
                 </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
               </ObjectAnimationUsingKeyFrames>
              </Storyboard>
             </VisualState>
            </VisualStateGroup>
           </VisualStateManager.VisualStateGroups>
           <Grid HorizontalAlignment="Left" VerticalAlignment="Top">
            <Rectangle x:Name="Background" Fill="#FFFFFFFF" Height="14" Margin="1" RadiusY="1" RadiusX="1" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}" Width="14"/>
            <Rectangle x:Name="BackgroundOverlay" Fill="#FFC4DBEE" Height="14" Margin="1" Opacity="0" RadiusY="1" RadiusX="1" Stroke="#00000000" StrokeThickness="1" Width="14"/>
            <Rectangle x:Name="BoxMiddleBackground" Fill="{TemplateBinding Background}" Height="10" RadiusY="1" RadiusX="1" Stroke="#00000000" StrokeThickness="1" Width="10"/>
            <Rectangle x:Name="BoxMiddle" Height="10" RadiusY="1" RadiusX="1" StrokeThickness="1" Width="10">
             <Rectangle.Fill>
              <LinearGradientBrush EndPoint="0.64,0.88" StartPoint="0.62,0.15">
               <GradientStop Color="#FFFFFFFF" Offset="0.013"/>
               <GradientStop Color="#F9FFFFFF" Offset="0.375"/>
               <GradientStop Color="#EAFFFFFF" Offset="0.603"/>
               <GradientStop Color="#D8FFFFFF" Offset="1"/>
              </LinearGradientBrush>
             </Rectangle.Fill>
             <Rectangle.Stroke>
              <LinearGradientBrush EndPoint=".5,1" StartPoint=".5,0">
               <GradientStop Color="#FFFFFFFF" Offset="1"/>
               <GradientStop Color="#FFFFFFFF" Offset="0"/>
               <GradientStop Color="#FFFFFFFF" Offset="0.375"/>
               <GradientStop Color="#FFFFFFFF" Offset="0.375"/>
              </LinearGradientBrush>
             </Rectangle.Stroke>
            </Rectangle>
            <Rectangle x:Name="BoxMiddleLine" Height="10" Opacity=".2" RadiusY="1" RadiusX="1" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1" Width="10"/>
            <Path x:Name="CheckIcon" Data="M102.03442,598.79645 L105.22962,597.78918 L106.78825,600.42358 C106.78825,600.42358 108.51028,595.74304 110.21724,593.60419 C112.00967,591.35822 114.89314,591.42316 114.89314,591.42316 C114.89314,591.42316 112.67844,593.42645 111.93174,594.44464 C110.7449,596.06293 107.15683,604.13837 107.15683,604.13837 z" Fill="#FF333333" FlowDirection="LeftToRight" Height="10" Margin="1,1,0,1.5" Opacity="0" Stretch="Fill" Width="10.5"/>
            <Rectangle x:Name="IndeterminateIcon" Fill="#FF333333" Height="2" Opacity="0" Width="6"/>
            <Rectangle x:Name="DisabledVisualElement" Fill="#FFFFFFFF" Height="14" Opacity="0" RadiusY="1" RadiusX="1" Width="14"/>
            <Rectangle x:Name="ContentFocusVisualElement" Height="16" IsHitTestVisible="false" Opacity="0" RadiusY="2" RadiusX="2" Stroke="#FF6DBDD1" StrokeThickness="1" Width="16"/>
            <Border x:Name="ValidationErrorElement" BorderBrush="#FFDB000C" BorderThickness="1" CornerRadius="1" Margin="1" ToolTipService.PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Visibility="Collapsed">
             <ToolTipService.ToolTip>
              <ToolTip x:Name="validationTooltip" DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}" Placement="Right" PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Template="{StaticResource ValidationToolTipTemplate}">
               <ToolTip.Triggers>
                <EventTrigger RoutedEvent="Canvas.Loaded">
                 <BeginStoryboard>
                  <Storyboard>
                   <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsHitTestVisible" Storyboard.TargetName="validationTooltip">
                    <DiscreteObjectKeyFrame KeyTime="0">
                     <DiscreteObjectKeyFrame.Value>
                      <System:Boolean>true</System:Boolean>
                     </DiscreteObjectKeyFrame.Value>
                    </DiscreteObjectKeyFrame>
                   </ObjectAnimationUsingKeyFrames>
                  </Storyboard>
                 </BeginStoryboard>
                </EventTrigger>
               </ToolTip.Triggers>
              </ToolTip>
             </ToolTipService.ToolTip>
             <Grid Background="Transparent" HorizontalAlignment="Right" Height="10" Margin="0,-4,-4,0" VerticalAlignment="Top" Width="10">
              <Path Data="M 1,0 L5,0 A 2,2 90 0 1 7,2 L7,6 z" Fill="#FFDC000C" Margin="0,3,0,0"/>
              <Path Data="M 0,0 L2,0 L 7,5 L7,7" Fill="#ffffff" Margin="0,3,0,0"/>
             </Grid>
            </Border>
           </Grid>
           <ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="1" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
          </Grid>
         </ControlTemplate>
        </Setter.Value>
       </Setter>
      </Style>

     

    Best Regards,

    Sunday, June 19, 2011 11:07 AM