Friday, October 12, 2012

Hit testing enabled until animation completes, despite a directive to disable at KeyTime=0

Hit testing enabled until animation completes, despite a directive to disable at KeyTime=0

In the XAML below, I have an animation that transitions via fade from a login dialog and welcome screen to an application dialog. At KeyTime="0", I disable hit testing on the login dialog and enable hit testing on the application dialog. However, during the fade process the login dialog is still capturing clicks; it's only until after the fade process completes that the application dialog captures clicks. I have tried re-arranging the code so that setting IsHitTestVisible on dialogApplication is first in the storyboard, but that has had no effect. What can I do different to ensure that disabling dialogLogin hit testing occurs before the animation?

     <VisualState x:Name="PICKAPPLICATION">             <Storyboard>                 <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.IsHitTestVisible)"                   Storyboard.TargetName="dialogLogin">                     <DiscreteObjectKeyFrame KeyTime="0">                         <DiscreteObjectKeyFrame.Value>                             <System:Boolean>False</System:Boolean>                         </DiscreteObjectKeyFrame.Value>                     </DiscreteObjectKeyFrame>                 </ObjectAnimationUsingKeyFrames>                 <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="dialogLogin" d:IsOptimized="True"/>                 <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="dialogApplication" d:IsOptimized="True"/>                 <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.IsHitTestVisible)"                  Storyboard.TargetName="dialogApplication">                     <DiscreteObjectKeyFrame KeyTime="0">                         <DiscreteObjectKeyFrame.Value>                             <System:Boolean>True</System:Boolean>                         </DiscreteObjectKeyFrame.Value>                     </DiscreteObjectKeyFrame>                 </ObjectAnimationUsingKeyFrames>                 <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="welcome" d:IsOptimized="True"/>                 <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.IsHitTestVisible)" Storyboard.TargetName="welcome">                     <DiscreteObjectKeyFrame KeyTime="0">                         <DiscreteObjectKeyFrame.Value>                             <System:Boolean>False</System:Boolean>                         </DiscreteObjectKeyFrame.Value>                     </DiscreteObjectKeyFrame>                 </ObjectAnimationUsingKeyFrames>             </Storyboard>         </VisualState> 

Answers & Comments...




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog