在一个UserControl
我有一个类型enum
(GroupStyle
类型eGroupStyle
)的DP和一个类型bool
(IsGrouped
)的DP。我需要在所有可能的情况下开始一些故事板。但MultiDataTrigger
只有最后一个有效。我哪里错了?另外我想知道是否存在一种更简单的方法来考虑这些条件。(检查IsGrouped
一次。)
C#:
enum eGroupStyle
{
GroupStyle1,
GroupStyle2,
∙∙∙,
GroupStyleN,
}
XAML:
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding GroupStyle}" Value="GroupStyle1"/>
<Condition Binding="{Binding IsGrouped}" Value="False"/>
</MultiDataTrigger.Conditions>
<MultiDataTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource Storyboard_TurnToUnselectedStyle1}"/>
</MultiDataTrigger.EnterActions>
</MultiDataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding GroupStyle}" Value="GroupStyle1"/>
<Condition Binding="{Binding IsGrouped}" Value="True"/>
</MultiDataTrigger.Conditions>
<MultiDataTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource Storyboard_TurnToSelectedStyle1}"/>
</MultiDataTrigger.EnterActions>
</MultiDataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding GroupStyle}" Value="GroupStyle2"/>
<Condition Binding="{Binding IsGrouped}" Value="False"/>
</MultiDataTrigger.Conditions>
<MultiDataTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource Storyboard_TurnToUnselectedStyle2}"/>
</MultiDataTrigger.EnterActions>
</MultiDataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding GroupStyle}" Value="GroupStyle2"/>
<Condition Binding="{Binding IsGrouped}" Value="True"/>
</MultiDataTrigger.Conditions>
<MultiDataTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource Storyboard_TurnToSelectedStyle2}"/>
</MultiDataTrigger.EnterActions>
</MultiDataTrigger>
∙∙∙
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding GroupStyle}" Value="GroupStyleN"/>
<Condition Binding="{Binding IsGrouped}" Value="False"/>
</MultiDataTrigger.Conditions>
<MultiDataTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource Storyboard_TurnToUnselectedStyleN}"/>
</MultiDataTrigger.EnterActions>
</MultiDataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding GroupStyle}" Value="GroupStyleN"/>
<Condition Binding="{Binding IsGrouped}" Value="True"/>
</MultiDataTrigger.Conditions>
<MultiDataTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource Storyboard_TurnToSelectedStyleN}"/>
</MultiDataTrigger.EnterActions>
</MultiDataTrigger>