0

我有一个按状态开始的故事板:

<VisualStateManager.VisualStateGroups>
    <VisualStateGroup x:Name="MySG">
        <VisualState x:Name="State1">
            <Storyboard>
                <BooleanAnimationUsingKeyFrames Storyboard.TargetName="Btn1" Storyboard.TargetProperty="(UIElement.IsEnabled)">
                    <DiscreteBooleanKeyFrame KeyTime="0" Value="True"/>
                </BooleanAnimationUsingKeyFrames>
            </Storyboard>
        </VisualState>
        <VisualState x:Name="State2">
            <Storyboard>
                <BooleanAnimationUsingKeyFrames Storyboard.TargetName="Btn1" Storyboard.TargetProperty="(UIElement.IsEnabled)">
                    <DiscreteBooleanKeyFrame KeyTime="0" Value="False"/>
                </BooleanAnimationUsingKeyFrames>
            </Storyboard>
        </VisualState>
    </VisualStateGroup>
</VisualStateManager.VisualStateGroups>

我想通过按钮中的触发器来停止它:

  <Button x:Name="Btn1"  Height="50" Width="200" Content="My Button">
            <Button.Triggers>
                <DataTrigger Binding="{Binding ElementName=txt1,Path=(Validation.HasError)}" Value="True">
                    <DataTrigger.EnterActions>
                        <StopStoryboard BeginStoryboardName="?"/>
                    </DataTrigger.EnterActions>
                    <DataTrigger.ExitActions>
                        <ResumeStoryboard BeginStoryboardName="?"/>
                    </DataTrigger.ExitActions>
                </DataTrigger>
            </Button.Triggers>
        </Button>

如果我不知道该怎么做BeginStoryboardName

4

0 回答 0