How can I make a WPF Image disableable?

前端 未结 5 1187
野趣味
野趣味 2021-01-21 04:54

I need an Image that is grayed out when disabled (IsEnabled=False). A grayed out version of the image can be produced by reading the BitmapImage into a FormatConvertedBitmap whi

5条回答
  •  北海茫月
    2021-01-21 05:17

    I made a little comparison based on the following solutions.

    • The approaches in the link provided by the OP
    • The links provided by Thomas Levesque
      • AutoDisabledImage
      • AutoGreyableImage
    • Greyscale Effect

    Since I already had a licens for the Infragistics Net Advantage for WPF it was easy to try it out

    Here is the result

    enter image description here

    So the best approach depends on what results you are after. As for me, I think the result produced by AutoDisabledImage from Infragistics is too bright, AutoGreyableImage does a pretty good job (Identical result to Approach 1 (OP link)) and GreyscaleEffect produces the best result.

提交回复
热议问题