title: How can I create a transparent user control in WPF?
body: <p>I have a WPF app with an image over which is laid a user control. I would like the user control background to be transparent but the buttons etc on that user control to be solid.</p>
  
  <p>The image below shows what I have now. I would like to have the inside of the red area as transparent (the user control can in theory be many different shapes) but with the controls contained within it, solid.</p>
  
  <p><img src="https://i.stack.imgur.com/HZ9sQ.png" alt="enter image description here"></p>
  
  <p>The main window XAML is;</p>
  
  <pre><code>&lt;Canvas Height="450" Width="300"&gt;
      &lt;Border Opacity=".2" &gt;
          &lt;Image Source="D:\\BarbourCoat.jpg" Width="300" &gt;&lt;/Image&gt;
      &lt;/Border&gt;
      &lt;local:UserControl1 Height="100" Canvas.Left="10" Canvas.Top="10" Width="100"/&gt;
  &lt;/Canvas&gt;
  </code></pre>
  
  <p>Whilst the user control XAML is;</p>
  
  <pre><code>&lt;Canvas Background="Transparent"&gt;
      &lt;Path Data="M 10 10 L 100 10 L 250 50 L 280 200 L 180 250 L 25 270 Z" Stroke="Red"&gt;&lt;/Path&gt;
      &lt;Button Content="Button" HorizontalAlignment="Left" Margin="41,53,0,0" VerticalAlignment="Top" Width="75"/&gt;
      &lt;TextBox HorizontalAlignment="Left" Height="23" Margin="90,112,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/&gt;
      &lt;TextBlock HorizontalAlignment="Left" Margin="69,209,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top"/&gt;
  &lt;/Canvas&gt;
  </code></pre>
  
  <p>I'm having a hard time getting my head round this, any help would be greatly appreciated.</p>