在WPF触发器开始在不同的控制故事板

在WPF触发器开始在不同的控制故事板

本文介绍了在WPF触发器开始在不同的控制故事板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

如果一个故事板动画落在ellipse1运行变化的不透明度,我可以触发其不透明度在某个值,并开始则ellipse2一个动画故事板将在开始褪色上呢?

 < UniformGrid列=2>
    <椭圆WIDTH =25HEIGHT =25NAME =ellipse1的>
        < Ellipse.Triggers>
            <7触发属性=透明度值=>
                做点什么这里开始一个不透明淡入则ellipse2
            < /触发>
        < /Ellipse.Triggers>
    < /椭圆>
    <椭圆WIDTH =25HEIGHT =25NAME =则ellipse2>    < /椭圆>
< / UniformGrid>


解决方案

您可以使用的中则ellipse2观察ellipse1的:

 <椭圆WIDTH =25HEIGHT =25NAME =则ellipse2>
    < Ellipse.Style>
        <风格的TargetType ={X:椭圆型}>
            < Style.Triggers>
                < D​​ataTrigger绑定={结合透明度,的ElementName =} ellipse1的VALUE =0.5>
                    < D​​ataTrigger.EnterActions>
                        < BeginStoryboard>
                            <! - 情节提要这里椭圆2 - >
                        < / BeginStoryboard>
                    < /DataTrigger.EnterActions>
                < / DataTrigger>
            < /Style.Triggers>
        < /样式和GT;
    < /Ellipse.Style>
< /椭圆>

If a storyboard animation is running on ellipse1 changing the opacity, can I trigger on its opacity at a certain value and start a storyboard animation on ellipse2 that will start a fade in on it?

<UniformGrid Columns="2">
    <Ellipse Width="25" Height="25" Name="ellipse1">
        <Ellipse.Triggers>
            <Trigger Property="Opacity" Value=".7">
                do something here to start a opacity fade in on ellipse2
            </Trigger>
        </Ellipse.Triggers>
    </Ellipse>
    <Ellipse Width="25" Height="25" Name="ellipse2">

    </Ellipse>
</UniformGrid>
解决方案

You could use a DataTrigger in ellipse2 to observe ellipse1:

<Ellipse Width="25" Height="25" Name="ellipse2">
    <Ellipse.Style>
        <Style TargetType="{x:Type Ellipse}">
            <Style.Triggers>
                <DataTrigger Binding="{Binding Opacity, ElementName=ellipse1}" Value="0.5">
                    <DataTrigger.EnterActions>
                        <BeginStoryboard>
                            <!-- Storyboard for ellipse 2 here -->
                        </BeginStoryboard>
                    </DataTrigger.EnterActions>
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </Ellipse.Style>
</Ellipse>

这篇关于在WPF触发器开始在不同的控制故事板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 20:33