View Revisions: Issue #1743

Summary 0001743: Crash when playing visual state animations
Revision 2020-07-01 17:14 by sfernandez
Steps To Reproduce
<Grid
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
   <Grid>
     <Grid.Resources>
       <!-- ToggleButton Style -->
       <Style x:Key="ToggleButtonStyle" TargetType="{x:Type ToggleButton}" >
         <Setter Property="Template">
           <Setter.Value>
             <ControlTemplate TargetType="{x:Type ToggleButton}">
               <Grid>
                 <VisualStateManager.VisualStateGroups>
                   <VisualStateGroup x:Name="CommonStates">
                     <VisualStateGroup.Transitions>
                       <VisualTransition GeneratedDuration="0:0:0.1" To="MouseOver"/>
                       <VisualTransition From="MouseOver" GeneratedDuration="0:0:0.5"/>
                     </VisualStateGroup.Transitions>
                     <VisualState x:Name="Normal"/>
                     <VisualState x:Name="MouseOver">
                       <Storyboard>
                         <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(Brush.Opacity)" Storyboard.TargetName="OverBorder">
                           <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
                         </DoubleAnimationUsingKeyFrames>
                         <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="ContentHost">
                           <EasingColorKeyFrame KeyTime="0" Value="White"/>
                         </ColorAnimationUsingKeyFrames>
                       </Storyboard>
                     </VisualState>
                     <VisualState x:Name="Disabled"/>
                   </VisualStateGroup>
                 </VisualStateManager.VisualStateGroups>
                 <Border x:Name="OverBorder">
                   <Border.Background>
                     <SolidColorBrush Color="Black" Opacity="0.5"/>
                   </Border.Background>
                 </Border>
                 <Border>
                   <ContentPresenter x:Name="ContentHost"/>
                 </Border>
               </Grid>
               <ControlTemplate.Triggers>
                 <Trigger Property="IsChecked" Value="True">
                   <Setter Property="Foreground" Value="Red"/>
                 </Trigger>
               </ControlTemplate.Triggers>
             </ControlTemplate>
           </Setter.Value>
         </Setter>
       </Style>
     </Grid.Resources>
 
     <ToggleButton Style="{StaticResource ToggleButtonStyle}">111</ToggleButton>
 
   </Grid>
</Grid>
Revision 2020-07-01 17:14 by sfernandez
Steps To Reproduce
<Grid
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
   <Grid>
     <Grid.Resources>
       <!-- ToggleButton Style -->
       <Style x:Key="ToggleButtonStyle" TargetType="{x:Type ToggleButton}" >
         <Setter Property="Template">
           <Setter.Value>
             <ControlTemplate TargetType="{x:Type ToggleButton}">
               <Grid>
                 <VisualStateManager.VisualStateGroups>
                   <VisualStateGroup x:Name="CommonStates">
                     <VisualStateGroup.Transitions>
                       <VisualTransition GeneratedDuration="0:0:0.1" To="MouseOver"/>
                       <VisualTransition From="MouseOver" GeneratedDuration="0:0:0.5"/>
                     </VisualStateGroup.Transitions>
                     <VisualState x:Name="Normal"/>
                     <VisualState x:Name="MouseOver">
                       <Storyboard>
                         <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(Brush.Opacity)" Storyboard.TargetName="OverBorder">
                           <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
                         </DoubleAnimationUsingKeyFrames>
                         <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="ContentHost">
                           <EasingColorKeyFrame KeyTime="0" Value="White"/>
                         </ColorAnimationUsingKeyFrames>
                       </Storyboard>
                     </VisualState>
                     <VisualState x:Name="Disabled"/>
                   </VisualStateGroup>
                 </VisualStateManager.VisualStateGroups>
                 <Border x:Name="OverBorder">
                   <Border.Background>
                     <SolidColorBrush Color="Black" Opacity="0.5"/>
                   </Border.Background>
                 </Border>
                 <Border>
                   <ContentPresenter x:Name="ContentHost"/>
                 </Border>
               </Grid>
               <ControlTemplate.Triggers>
                 <Trigger Property="IsChecked" Value="True">
                   <Setter Property="Foreground" Value="Red"/>
                 </Trigger>
               </ControlTemplate.Triggers>
             </ControlTemplate>
           </Setter.Value>
         </Setter>
       </Style>
     </Grid.Resources>
 
     <ToggleButton Style="{StaticResource ToggleButtonStyle}">111</ToggleButton>
 
   </Grid>
</Grid>