0
<MultiDataTrigger>
    <MultiDataTrigger.Conditions>
        <Condition Binding="{Binding ElementName=Switcher, Path=On}" Value="True"></Condition>
        <Condition Binding="{Binding ElementName=Switcher, Path=IsMouseOver}" Value="True"></Condition>
    </MultiDataTrigger.Conditions>
    <!-- Fire when IsMouseOver is set to true and On is set to true -->
    <MultiDataTrigger.EnterActions>                                        
        <BeginStoryboard>
            <Storyboard>
                <DoubleAnimation Storyboard.TargetName="Slider" Storyboard.TargetProperty="Width" To="35" Duration="0:0:0.3"/>
                <ThicknessAnimation Storyboard.TargetName="Slider" Storyboard.TargetProperty="Margin" To="30 5 5 5" Duration="0:0:0.3"/>
            </Storyboard>
        </BeginStoryboard>
    </MultiDataTrigger.EnterActions>
    <!-- Fire when IsMouseOver is set to false and On is set to true -->
    <MultiDataTrigger.ExitActions>
        <BeginStoryboard>
            <Storyboard>
                <DoubleAnimation Storyboard.TargetName="Slider" Storyboard.TargetProperty="Width" To="30" Duration="0:0:0.3"/>
                <ThicknessAnimation Storyboard.TargetName="Slider" Storyboard.TargetProperty="Margin" To="35 5 5 5" Duration="0:0:0.3"/>
            </Storyboard>
        </BeginStoryboard>
    </MultiDataTrigger.ExitActions>
</MultiDataTrigger>

<MultiDataTrigger>
    <MultiDataTrigger.Conditions>
        <Condition Binding="{Binding ElementName=Switcher, Path=On}" Value="False"></Condition>
        <Condition Binding="{Binding ElementName=Switcher, Path=IsMouseOver}" Value="True"></Condition>
    </MultiDataTrigger.Conditions>
    <!-- Fire when IsMouseOver is set to true and On is set to false -->
    <MultiDataTrigger.EnterActions>
        <BeginStoryboard>
            <Storyboard>
                <DoubleAnimation Storyboard.TargetName="Slider" Storyboard.TargetProperty="Width" To="35" Duration="0:0:0.3"/>                                                
            </Storyboard>
        </BeginStoryboard>
    </MultiDataTrigger.EnterActions>
    <!-- Fire when IsMouseOver is set to false and On is set to false -->
    <MultiDataTrigger.ExitActions>
        <BeginStoryboard>
            <Storyboard>
                <DoubleAnimation Storyboard.TargetName="Slider" Storyboard.TargetProperty="Width" To="30" Duration="0:0:0.3"/>                                                
            </Storyboard>
        </BeginStoryboard>
    </MultiDataTrigger.ExitActions>
</MultiDataTrigger>

我有以下多数据触发器。还检查了依赖属性,这就是我不在这里发布它的原因。我对每个数据触发器进入和退出他们应该做的动作都有评论。第二个工作得很好。但是我无法让第一个工作!数据触发器是否有任何可能的工作方式,但我的故事板被覆盖

4

0 回答 0