Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Disabled" effect on Image

In Win Forms when I disable a button its image background converts to gray-level image. How can I simulate this effect in Image control using XAML codes?

like image 867
Babak.Abad Avatar asked May 29 '26 10:05

Babak.Abad


1 Answers

you can set the opacity of image in button like below:

<Button>
  <Image Source="button.png">
    <Image.Style>
      <Style TargetType="Image">
        <Style.Triggers>
          <Trigger Property="IsEnabled" Value="False">
            <Setter Property="Opacity" Value="0.4" />
          </Trigger>
        </Style.Triggers>
      </Style>
    </Image.Style>
  </Image>
</Button>
like image 72
Nitin Avatar answered May 31 '26 22:05

Nitin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!