1
所以我有多邊形:WPF MultiDataTrigger不工作
<Polygon Points="1.875,0.875 2.75,13.875 18.875,11 16.625,-3.375 1.875,0.875 "
Style="{ StaticResource BlockView}"
Name="KEY_1"
Canvas.Left="35"
Canvas.Top="211"
attachedproperty:UtilityFunctions.IsDualModeActive="{Binding GetDevice.SelectedProfile.IsDualMode,Mode=TwoWay}" />
我想多邊形的行程來改變基於IsMouseOver屬性的值和一個附加的屬性,它是這樣的:
public static readonly DependencyProperty IsDualModeActiveProperty = DependencyProperty.RegisterAttached(
"IsDualModeActive",
typeof(Boolean),
typeof(UtilityFunctions)
);
public static void SetIsDualModeActive(UIElement element, Boolean value)
{
element.SetValue(IsDualModeActiveProperty, value);
}
public static Boolean GetIsDualModeActive(UIElement element)
{
return (Boolean)element.GetValue(IsDualModeActiveProperty);
}
附加的屬性綁定到我的ViewModel屬性,你可以在多邊形代碼中看到。 然後,我有這個觸發器在樣式資源定義:
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsMouseOver }"
Value="True" />
<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsDualModeActive }"
Value="False" />
</MultiDataTrigger.Conditions>
<MultiDataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="Stroke.Color"
To="#73BB00"
Duration="{StaticResource controlTransitionEnterDuration}" />
</Storyboard>
</BeginStoryboard>
</MultiDataTrigger.EnterActions>
<MultiDataTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="Stroke.Color"
Duration="{StaticResource controlTransitionEnterDuration}" />
</Storyboard>
</BeginStoryboard>
</MultiDataTrigger.ExitActions>
<Setter Property="Opacity" Value="3" />
</MultiDataTrigger>
問題是我已經檢查鼠標懸停和attachedproperty的值,它們滿足觸發條件,但多邊形的行程不會改變。 我錯過了這裏的任何事情? 謝謝。