WPF:具有多属性条件的 DataTrigger

WPF: DataTrigger with multi properties condition

所以我有这个 DataTrigger:

<DataTrigger Binding="{Binding Path=IsFilesSelected}" Value="True">
    <DataTrigger.EnterActions>
        <StopStoryboard BeginStoryboardName="EndAnimation"/>
        <BeginStoryboard Name="NewAnimation">
            <Storyboard>
                <ThicknessAnimation Storyboard.TargetProperty="Margin"                                                                        
                                    From="0,50,0,0"                                                                         
                                    To="0,0,0,0"                                                                       
                                    DecelerationRatio=".9"                                                                   
                                    Duration="0:0:0.3" />
            </Storyboard>
        </BeginStoryboard>
    </DataTrigger.EnterActions>
</DataTrigger>

正如您所见,当我的 IsFilesSelected 属性 更改为 True 时,此 DataTrigger 开始,我想知道如何分配另一个 属性 和在确定我是否需要开始我的 DataTrigger.

时也要考虑它的价值

您要找的是 MultiDataTriggerdocumentation here

Represents a trigger that applies property values or performs actions when the bound data meet a set of conditions.

示例摘自 MSDN 网站

<MultiDataTrigger>
    <MultiDataTrigger.Conditions>
        <Condition Binding="{Binding Path=Name}" Value="Portland" />
        <Condition Binding="{Binding Path=State}" Value="OR" />
    </MultiDataTrigger.Conditions>
    <Setter Property="Background" Value="Cyan" />
</MultiDataTrigger>

上面的例子将设置 Background 属性 当 Name == "Portland" AND State == "OR".