3

I have defined two animations in a datatemplate for a grid cell.

    <DataTemplate.Resources>
        <Storyboard x:Key="ShowMenuStory">
            <BooleanAnimationUsingKeyFrames Storyboard.TargetName="PART_Menu" Storyboard.TargetProperty="IsOpen">
                <!-- in two seconds the popup is opened -->
                <DiscreteBooleanKeyFrame Value="True" KeyTime="0:0:2.0" />
            </BooleanAnimationUsingKeyFrames>
        </Storyboard>
        <Storyboard x:Key="HideMenuStory">
            <BooleanAnimationUsingKeyFrames Storyboard.TargetName="PART_Menu" Storyboard.TargetProperty="IsOpen">
                <!-- immediately poup is closed -->
                <DiscreteBooleanKeyFrame Value="False" KeyTime="0:0:0.1" />
            </BooleanAnimationUsingKeyFrames>
        </Storyboard>
    </DataTemplate.Resources>

In the DataTemplate.Triggers try to manage my storyboards so:

        <DataTemplate.Triggers>
        <DataTrigger Binding="{Binding IsFocused, ElementName=PART_Editor}" Value="True">
            <DataTrigger.EnterActions>
                <StopStoryboard BeginStoryboardName="HideStory" />
                <BeginStoryboard Name="ShowStory" Storyboard="{StaticResource ShowMenuStory}" />
            </DataTrigger.EnterActions>
            <DataTrigger.ExitActions>
                <StopStoryboard BeginStoryboardName="ShowStory" />
                <BeginStoryboard Name="HideStory" Storyboard="{StaticResource HideMenuStory}" />
            </DataTrigger.ExitActions>
        </DataTrigger>
    </DataTemplate.Triggers>

The problem is that when I am focusing the cell, firstly try to stop an animation (HideStory) that was not yet executed. That produces the follow warning:

System.Windows.Media.Animation Warning: 6 : Unable to perform action because the specified Storyboard was never applied to this object for interactive control.; Action='Remove'; ...

Do you know how can I avoid this warning in xaml? Thanks

MrScf
  • 2,407
  • 5
  • 27
  • 40

0 Answers0