0
有兩個行爲根據其容器按鈕的IsEnabled屬性更改路徑的不透明度。我有幾個按鈕,我想重複使用這兩種行爲,因爲它們的容器具有相同的路徑。我怎麼做?如何重用行爲?
<Button x:Name="buttonConcentration">
<Canvas Width="42.6667" Height="42.6667">
<Path Opacity="0.2" Width="42.835" Height="42.696" Stretch="Fill"
Data="..." UseLayoutRounding="False">
<Interactivity:Interaction.Behaviors>
<Core:DataTriggerBehavior
Binding="{Binding IsEnabled, ElementName=buttonConcentration}"
Value="False">
<Core:ChangePropertyAction PropertyName="Opacity" Value="0.2"/>
</Core:DataTriggerBehavior>
<Core:DataTriggerBehavior
Binding="{Binding IsEnabled, ElementName=buttonConcentration}"
Value="True">
<Core:ChangePropertyAction PropertyName="Opacity" Value="1"/>
</Core:DataTriggerBehavior>
</Interactivity:Interaction.Behaviors>
</Path>
</Canvas>
</Button>
OK,但不會的ElementName需要是某種相對路徑(這似乎我不能上班)? –
我會編輯它。給我幾分鐘。 –
任何更新是否有效? –