title: WPF: Image as Background with Opacity Mask
body: <p>I haven't been able to get this to work, but this is what I envision:</p>
  
  <p>Essentially, I want to have a control in WPF where the background is set to a left aligned image with an opacity mask that fades the right side of the image out into transparency (so that the parent's background color shows through)</p>
  
  <p>Is this type of thing possible? Here's what I've tried:</p>
  
  <pre><code>&lt;DockPanel x:Name="ContentPanel" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"&gt;
      &lt;DockPanel.Background&gt;                    
        &lt;ImageBrush ImageSource="test.jpg" Stretch="None" AlignmentX="Left" AlignmentY="Center" /&gt;
      &lt;/DockPanel.Background&gt;
      &lt;DockPanel.OpacityMask&gt;
        &lt;LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"&gt;
          &lt;GradientStop Color="Black" Offset="0"/&gt;
          &lt;GradientStop Color="White" Offset="0.5"/&gt;
        &lt;/LinearGradientBrush&gt;
      &lt;/DockPanel.OpacityMask&gt;
  &lt;/DockPanel&gt;
  </code></pre>