locked
RadioButton indeterminate state in the MSDN ControlTemplate RRS feed

Answers

  • First, make sure somewhere or In code you set the radio button reference to null - setting to null is what sets the indeterminate state.

    Just modify the visual state indeterminate under the radio button. To test..  Here is an example to simply demo the concept.

    Right Click RadioButton->Edit Template->Current/Copy

    Click states panel expand checked states group and select indeterminate

    In objects/timeline expand Template-Grid-Grid

    Modify background and box middle

    In code set the radio button reference to null - setting to null is what sets the indeterminate state

    See your indeterminate state

     (its good practice to not change an object property in more than one state group.. this was a quick demo)

     code behind:

     radioButton1.IsChecked = null;

    Xaml style: 

    <ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="
    http://schemas.microsoft.com/winfx/2006/xaml" xmlns:System="clr-namespace:System;assembly=mscorlib"&gt;
    <!-- Resource dictionary entries should be defined here. -->
    <Style x:Key="RadioButtonStyle1" TargetType="RadioButton">
    <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="RadioButton">
    <Grid>
    <VisualStateManager.VisualStateGroups>
    <VisualStateGroup x:Name="CommonStates">
    <VisualState x:Name="Normal"/>
    <VisualState x:Name="MouseOver">
    <Storyboard>
    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BackgroundOverlay" Storyboard.TargetProperty="Opacity">
    <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BoxMiddleBackground" Storyboard.TargetProperty="Opacity">
    <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
    </DoubleAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
    <SplineColorKeyFrame KeyTime="0" Value="#7FFFFFFF"/>
    </ColorAnimationUsingKeyFrames>
    </Storyboard>
    </VisualState>
    <VisualState x:Name="Pressed">
    <Storyboard>
    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BackgroundOverlay" Storyboard.TargetProperty="Opacity">
    <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BoxMiddleBackground" Storyboard.TargetProperty="Opacity">
    <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
    </DoubleAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
    <SplineColorKeyFrame KeyTime="0" Value="#6BFFFFFF"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
    <SplineColorKeyFrame KeyTime="0" Value="#F4FFFFFF"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[3].(GradientStop.Color)">
    <SplineColorKeyFrame KeyTime="0" Value="#FF6DBDD1"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
    <SplineColorKeyFrame KeyTime="0" Value="#FF6DBDD1"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
    <SplineColorKeyFrame KeyTime="0" Value="#FF6DBDD1"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[2].(GradientStop.Color)">
    <SplineColorKeyFrame KeyTime="0" Value="#FF6DBDD1"/>
    </ColorAnimationUsingKeyFrames>
    </Storyboard>
    </VisualState>
    <VisualState x:Name="Disabled">
    <Storyboard>
    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="contentPresenter" Storyboard.TargetProperty="(UIElement.Opacity)">
    <SplineDoubleKeyFrame KeyTime="0" Value=".55"/>
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="(UIElement.Opacity)">
    <SplineDoubleKeyFrame KeyTime="0" Value="0.55"/>
    </DoubleAnimationUsingKeyFrames>
    </Storyboard>
    </VisualState>
    </VisualStateGroup>
    <VisualStateGroup x:Name="CheckStates">
    <VisualState x:Name="Checked">
    <Storyboard>
    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="CheckIcon" Storyboard.TargetProperty="(UIElement.Opacity)">
    <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
    </DoubleAnimationUsingKeyFrames>
    </Storyboard>
    </VisualState>
    <VisualState x:Name="Unchecked"/>
    <VisualState x:Name="Indeterminate">
    <Storyboard>
    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
    <EasingColorKeyFrame KeyTime="00:00:00" Value="#D8000000"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="Background" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
    <EasingColorKeyFrame KeyTime="00:00:00" Value="#FF73DC00"/>
    </ColorAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Offset)">
    <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0.413"/>
    </DoubleAnimationUsingKeyFrames>
    </Storyboard>
    </VisualState>
    </VisualStateGroup>
    <VisualStateGroup x:Name="FocusStates">
    <VisualState x:Name="Focused">
    <Storyboard>
    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="ContentFocusVisualElement" Storyboard.TargetProperty="Opacity">
    <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
    </DoubleAnimationUsingKeyFrames>
    </Storyboard>
    </VisualState>
    <VisualState x:Name="Unfocused"/>
    </VisualStateGroup>
    <VisualStateGroup x:Name="ValidationStates">
    <VisualState x:Name="Valid"/>
    <VisualState x:Name="InvalidUnfocused">
    <Storyboard>
    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
    <DiscreteObjectKeyFrame KeyTime="0">
    <DiscreteObjectKeyFrame.Value>
    <Visibility>Visible</Visibility>
    </DiscreteObjectKeyFrame.Value>
    </DiscreteObjectKeyFrame>
    </ObjectAnimationUsingKeyFrames>
    </Storyboard>
    </VisualState>
    <VisualState x:Name="InvalidFocused">
    <Storyboard>
    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
    <DiscreteObjectKeyFrame KeyTime="0">
    <DiscreteObjectKeyFrame.Value>
    <Visibility>Visible</Visibility>
    </DiscreteObjectKeyFrame.Value>
    </DiscreteObjectKeyFrame>
    </ObjectAnimationUsingKeyFrames>
    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsOpen">
    <DiscreteObjectKeyFrame KeyTime="0">
    <DiscreteObjectKeyFrame.Value>
    <System:Boolean>True</System:Boolean>
    </DiscreteObjectKeyFrame.Value>
    </DiscreteObjectKeyFrame>
    </ObjectAnimationUsingKeyFrames>
    </Storyboard>
    </VisualState>
    </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>
    <Grid.ColumnDefinitions>
    <ColumnDefinition Width="16"/>
    <ColumnDefinition Width="*"/>
    </Grid.ColumnDefinitions>
    <Grid HorizontalAlignment="Left" VerticalAlignment="Top">
    <Ellipse x:Name="Background" Fill="#FFFFFFFF" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}" Height="14" Margin="1" Width="14"/>
    <Ellipse x:Name="BackgroundOverlay" Fill="#FFC4DBEE" Stroke="#00000000" StrokeThickness="1" Height="14" Margin="1" Width="14" Opacity="0"/>
    <Ellipse x:Name="BoxMiddleBackground" Fill="{TemplateBinding Background}" Stroke="#00000000" StrokeThickness="1" Height="10" Width="10"/>
    <Ellipse x:Name="BoxMiddle" StrokeThickness="1" Height="10" Width="10">
    <Ellipse.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>
    </Ellipse.Stroke>
    <Ellipse.Fill>
    <LinearGradientBrush EndPoint="0.64,0.88" StartPoint="0.62,0.15">
    <GradientStop Color="#FFFFFFFF" Offset="0.013"/>
    <GradientStop Color="#D8FFFFFF" Offset="1"/>
    </LinearGradientBrush>
    </Ellipse.Fill>
    </Ellipse>
    <Ellipse x:Name="BoxMiddleLine" Stroke="#FF333333" StrokeThickness="1" Height="10" Width="10" Opacity=".2"/>
    <Ellipse x:Name="CheckIcon" Fill="#FF333333" Height="4" Width="4" Opacity="0"/>
    <Ellipse x:Name="DisabledVisualElement" Fill="#FFFFFFFF" Height="14" Width="14" Opacity="0"/>
    <Ellipse x:Name="ContentFocusVisualElement" Stroke="#FF6DBDD1" StrokeThickness="1" Height="16" Width="16" IsHitTestVisible="false" Opacity="0"/>
    <Grid x:Name="ValidationErrorElement" Visibility="Collapsed" ToolTipService.PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}">
    <ToolTipService.ToolTip>
    <ToolTip x:Name="validationTooltip" DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}" Template="{StaticResource ValidationToolTipTemplate}" Placement="Right" PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}">
    <ToolTip.Triggers>
    <EventTrigger RoutedEvent="Canvas.Loaded">
    <BeginStoryboard>
    <Storyboard>
    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsHitTestVisible">
    <DiscreteObjectKeyFrame KeyTime="0">
    <DiscreteObjectKeyFrame.Value>
    <System:Boolean>true</System:Boolean>
    </DiscreteObjectKeyFrame.Value>
    </DiscreteObjectKeyFrame>
    </ObjectAnimationUsingKeyFrames>
    </Storyboard>
    </BeginStoryboard>
    </EventTrigger>
    </ToolTip.Triggers>
    </ToolTip>
    </ToolTipService.ToolTip>
    <Ellipse Stroke="#FFDB000C" StrokeThickness="1" Height="14" Width="14"/>
    <Ellipse Fill="#FFDB000C" Height="4" HorizontalAlignment="Right" Margin="0,-2,-1,0" VerticalAlignment="Top" Width="4"/>
    <Ellipse Fill="Transparent" Height="10" HorizontalAlignment="Right" Margin="0,-5,-4,0" VerticalAlignment="Top" Width="10"/>
    </Grid>
    </Grid>
    <ContentPresenter x:Name="contentPresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Grid.Column="1" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
    </Grid>
    </ControlTemplate>
    </Setter.Value>
    </Setter>
    </Style>
    </ResourceDictionary>
     
    Wednesday, May 12, 2010 5:53 PM

All replies

  • First, make sure somewhere or In code you set the radio button reference to null - setting to null is what sets the indeterminate state.

    Just modify the visual state indeterminate under the radio button. To test..  Here is an example to simply demo the concept.

    Right Click RadioButton->Edit Template->Current/Copy

    Click states panel expand checked states group and select indeterminate

    In objects/timeline expand Template-Grid-Grid

    Modify background and box middle

    In code set the radio button reference to null - setting to null is what sets the indeterminate state

    See your indeterminate state

     (its good practice to not change an object property in more than one state group.. this was a quick demo)

     code behind:

     radioButton1.IsChecked = null;

    Xaml style: 

    <ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="
    http://schemas.microsoft.com/winfx/2006/xaml" xmlns:System="clr-namespace:System;assembly=mscorlib"&gt;
    <!-- Resource dictionary entries should be defined here. -->
    <Style x:Key="RadioButtonStyle1" TargetType="RadioButton">
    <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="RadioButton">
    <Grid>
    <VisualStateManager.VisualStateGroups>
    <VisualStateGroup x:Name="CommonStates">
    <VisualState x:Name="Normal"/>
    <VisualState x:Name="MouseOver">
    <Storyboard>
    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BackgroundOverlay" Storyboard.TargetProperty="Opacity">
    <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BoxMiddleBackground" Storyboard.TargetProperty="Opacity">
    <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
    </DoubleAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
    <SplineColorKeyFrame KeyTime="0" Value="#7FFFFFFF"/>
    </ColorAnimationUsingKeyFrames>
    </Storyboard>
    </VisualState>
    <VisualState x:Name="Pressed">
    <Storyboard>
    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BackgroundOverlay" Storyboard.TargetProperty="Opacity">
    <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BoxMiddleBackground" Storyboard.TargetProperty="Opacity">
    <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
    </DoubleAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
    <SplineColorKeyFrame KeyTime="0" Value="#6BFFFFFF"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
    <SplineColorKeyFrame KeyTime="0" Value="#F4FFFFFF"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[3].(GradientStop.Color)">
    <SplineColorKeyFrame KeyTime="0" Value="#FF6DBDD1"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
    <SplineColorKeyFrame KeyTime="0" Value="#FF6DBDD1"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
    <SplineColorKeyFrame KeyTime="0" Value="#FF6DBDD1"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[2].(GradientStop.Color)">
    <SplineColorKeyFrame KeyTime="0" Value="#FF6DBDD1"/>
    </ColorAnimationUsingKeyFrames>
    </Storyboard>
    </VisualState>
    <VisualState x:Name="Disabled">
    <Storyboard>
    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="contentPresenter" Storyboard.TargetProperty="(UIElement.Opacity)">
    <SplineDoubleKeyFrame KeyTime="0" Value=".55"/>
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="(UIElement.Opacity)">
    <SplineDoubleKeyFrame KeyTime="0" Value="0.55"/>
    </DoubleAnimationUsingKeyFrames>
    </Storyboard>
    </VisualState>
    </VisualStateGroup>
    <VisualStateGroup x:Name="CheckStates">
    <VisualState x:Name="Checked">
    <Storyboard>
    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="CheckIcon" Storyboard.TargetProperty="(UIElement.Opacity)">
    <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
    </DoubleAnimationUsingKeyFrames>
    </Storyboard>
    </VisualState>
    <VisualState x:Name="Unchecked"/>
    <VisualState x:Name="Indeterminate">
    <Storyboard>
    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
    <EasingColorKeyFrame KeyTime="00:00:00" Value="#D8000000"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="Background" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
    <EasingColorKeyFrame KeyTime="00:00:00" Value="#FF73DC00"/>
    </ColorAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Offset)">
    <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0.413"/>
    </DoubleAnimationUsingKeyFrames>
    </Storyboard>
    </VisualState>
    </VisualStateGroup>
    <VisualStateGroup x:Name="FocusStates">
    <VisualState x:Name="Focused">
    <Storyboard>
    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="ContentFocusVisualElement" Storyboard.TargetProperty="Opacity">
    <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
    </DoubleAnimationUsingKeyFrames>
    </Storyboard>
    </VisualState>
    <VisualState x:Name="Unfocused"/>
    </VisualStateGroup>
    <VisualStateGroup x:Name="ValidationStates">
    <VisualState x:Name="Valid"/>
    <VisualState x:Name="InvalidUnfocused">
    <Storyboard>
    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
    <DiscreteObjectKeyFrame KeyTime="0">
    <DiscreteObjectKeyFrame.Value>
    <Visibility>Visible</Visibility>
    </DiscreteObjectKeyFrame.Value>
    </DiscreteObjectKeyFrame>
    </ObjectAnimationUsingKeyFrames>
    </Storyboard>
    </VisualState>
    <VisualState x:Name="InvalidFocused">
    <Storyboard>
    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
    <DiscreteObjectKeyFrame KeyTime="0">
    <DiscreteObjectKeyFrame.Value>
    <Visibility>Visible</Visibility>
    </DiscreteObjectKeyFrame.Value>
    </DiscreteObjectKeyFrame>
    </ObjectAnimationUsingKeyFrames>
    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsOpen">
    <DiscreteObjectKeyFrame KeyTime="0">
    <DiscreteObjectKeyFrame.Value>
    <System:Boolean>True</System:Boolean>
    </DiscreteObjectKeyFrame.Value>
    </DiscreteObjectKeyFrame>
    </ObjectAnimationUsingKeyFrames>
    </Storyboard>
    </VisualState>
    </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>
    <Grid.ColumnDefinitions>
    <ColumnDefinition Width="16"/>
    <ColumnDefinition Width="*"/>
    </Grid.ColumnDefinitions>
    <Grid HorizontalAlignment="Left" VerticalAlignment="Top">
    <Ellipse x:Name="Background" Fill="#FFFFFFFF" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}" Height="14" Margin="1" Width="14"/>
    <Ellipse x:Name="BackgroundOverlay" Fill="#FFC4DBEE" Stroke="#00000000" StrokeThickness="1" Height="14" Margin="1" Width="14" Opacity="0"/>
    <Ellipse x:Name="BoxMiddleBackground" Fill="{TemplateBinding Background}" Stroke="#00000000" StrokeThickness="1" Height="10" Width="10"/>
    <Ellipse x:Name="BoxMiddle" StrokeThickness="1" Height="10" Width="10">
    <Ellipse.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>
    </Ellipse.Stroke>
    <Ellipse.Fill>
    <LinearGradientBrush EndPoint="0.64,0.88" StartPoint="0.62,0.15">
    <GradientStop Color="#FFFFFFFF" Offset="0.013"/>
    <GradientStop Color="#D8FFFFFF" Offset="1"/>
    </LinearGradientBrush>
    </Ellipse.Fill>
    </Ellipse>
    <Ellipse x:Name="BoxMiddleLine" Stroke="#FF333333" StrokeThickness="1" Height="10" Width="10" Opacity=".2"/>
    <Ellipse x:Name="CheckIcon" Fill="#FF333333" Height="4" Width="4" Opacity="0"/>
    <Ellipse x:Name="DisabledVisualElement" Fill="#FFFFFFFF" Height="14" Width="14" Opacity="0"/>
    <Ellipse x:Name="ContentFocusVisualElement" Stroke="#FF6DBDD1" StrokeThickness="1" Height="16" Width="16" IsHitTestVisible="false" Opacity="0"/>
    <Grid x:Name="ValidationErrorElement" Visibility="Collapsed" ToolTipService.PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}">
    <ToolTipService.ToolTip>
    <ToolTip x:Name="validationTooltip" DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}" Template="{StaticResource ValidationToolTipTemplate}" Placement="Right" PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}">
    <ToolTip.Triggers>
    <EventTrigger RoutedEvent="Canvas.Loaded">
    <BeginStoryboard>
    <Storyboard>
    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsHitTestVisible">
    <DiscreteObjectKeyFrame KeyTime="0">
    <DiscreteObjectKeyFrame.Value>
    <System:Boolean>true</System:Boolean>
    </DiscreteObjectKeyFrame.Value>
    </DiscreteObjectKeyFrame>
    </ObjectAnimationUsingKeyFrames>
    </Storyboard>
    </BeginStoryboard>
    </EventTrigger>
    </ToolTip.Triggers>
    </ToolTip>
    </ToolTipService.ToolTip>
    <Ellipse Stroke="#FFDB000C" StrokeThickness="1" Height="14" Width="14"/>
    <Ellipse Fill="#FFDB000C" Height="4" HorizontalAlignment="Right" Margin="0,-2,-1,0" VerticalAlignment="Top" Width="4"/>
    <Ellipse Fill="Transparent" Height="10" HorizontalAlignment="Right" Margin="0,-5,-4,0" VerticalAlignment="Top" Width="10"/>
    </Grid>
    </Grid>
    <ContentPresenter x:Name="contentPresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Grid.Column="1" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
    </Grid>
    </ControlTemplate>
    </Setter.Value>
    </Setter>
    </Style>
    </ResourceDictionary>
     
    Wednesday, May 12, 2010 5:53 PM
  • Thanks for the information that helped. My derived class had to change the opacity of the image when you moused over (if not already checked) so I ended up implementing most of this inside the code behind, and using a slightly flakey if (e.Key == Key.Space) in the keydown. It would be good if the MSDN writers included some of the information you gave in the documentation.
    Monday, May 17, 2010 5:59 AM