title: How can I make a WPF Image disableable?
body: <p>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 which is shown <a href="http://apocryph.org/2007/08/26/rendering_disabled_grayed_out_image_buttons_wpf/" rel="nofollow noreferrer">here</a>.</p>
  
  <p>I have been able to get this working with a UserControl but now <strong>I would like the same behavior in a specialized Image class</strong> for more flexibility. I don't care if this is implemented in XAML, code-behind or both, but it needs to be a subclass of Image.</p>
  
  <p>The usage could be:</p>
  
  <pre><code>&lt;DisableableImage Source="Images/image1.png" /&gt;
  &lt;DisableableImage Source="Images/image1.png" IsEnabled="False" /&gt;
  
  &lt;!-- Since IsEnabled is inherited down the tree,
       the image will be grayed out like the rest of the button --&gt;
  &lt;Button IsEnabled="False"&gt;
      &lt;StackPanel Orientation="Horizontal"&gt;
          &lt;TextBlock&gt;OK&lt;/TextBlock&gt;
          &lt;DisableableImage Source="Images/ok.png" /&gt;
      &lt;/StackPanel&gt;
  &lt;/Button&gt;
  </code></pre>