2016-07-30 8 views
1

を働いていないので、私はポリゴン持っている:私はポリゴンのストロークがIsMouseOverプロパティと、このようなものです添付プロパティの値に基づいて変更したい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}" /> 

を:

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の値をチェックしていて、彼らはトリガ条件を満たしているが、多角形のストロークは変更されません。 私はここに欠けているものは何ですか?おかげさまで

答えて

1

あなたが添付プロパティを指定するには、プロパティパスを使用する場合、あなたはまた、それはブラケットの構文を使用して定義されていますタイプを指定する必要があります。

<Condition Binding="{Binding RelativeSource={RelativeSource Self}, 
    Path=(attachedproperty:UtilityFunctions.IsDualModeActive)}" Value="False" /> 
関連する問題