I have a targeted WPF style:
<Style x:Key="ImgFadeStyle"
TargetType="Image">
<Style.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Opacity" Value=".5" />
</Trigger>
</Style.Triggers>
</Style>
I apply it to some images:
<Image Name="imgFirst"
Grid.Column="0"
Style="{StaticResource ImgFadeStyle}"
Source="pack://application:,,,/AppGUI;component/Images/Temp/resultset_first.png"
ToolT开发者_开发技巧ip="First"
MouseLeftButtonUp="imgFirst_MouseLeftButtonUp" />
<Image Name="imgLast"
Grid.Column="6"
Style="{StaticResource ImgFadeStyle}"
Source="pack://application:,,,/AppGUI;component/Images/Temp/resultset_last.png"
ToolTip="Last"
MouseLeftButtonUp="imgLast_MouseLeftButtonUp" />
In the codebehind, I set the IsEnabled property to "true" or "false". The first image always reacts as expected. The second image does not react to the property change. Does anyone know what is wrong?
Thanks.
This could possibly be an issue caused by Dependency Property value precedence, if you set the Opacity of the last image somewhere explicitly this might override the style's efforts.
加载中,请稍侯......
精彩评论