Thank! I tried the suggested code after all my buttons. Does not work. I tried to extract only the trigger and insert it into the general button, in which all the other inherited buttons: worked like a charm! First this code:
<Style x:Key="SecButton" TargetType="Button"> <Setter Property="FontSize" Value="16" /> <Setter Property="Margin" Value="0,0,5,5" /> <Style.Triggers> <Trigger Property="IsEnabled" Value="False"> <Setter Property="Opacity" Value=".5" /> </Trigger> </Style.Triggers> </Style>
Based on the code above, I created these buttons:
<Style x:Key="NewBtnStyle" TargetType="Button" BasedOn="{StaticResource SecButton}"> <Setter Property="ContentTemplate"> <Setter.Value> <DataTemplate> <StackPanel Orientation="Horizontal"> <Image Source="Images/new.png" Width="50" Height="50" /> </StackPanel> </DataTemplate> </Setter.Value> </Setter> </Style>
When the buttons where disabled, the images in them are automatically darkened to 0.5 opacity.
aeinstein Jun 20 2018-12-12T00: 00Z
source share