title: How can I make an "overlay" window that allows mouse clicks to pass through to windows below it, but still allow some controls to be clicked?
body: <p>I am trying to make a window that acts as an "overlay" on top of everything else on my screen. It should not interfere with input to other windows, so I should be able to click through to whatever is under it, with a few exceptions, like small buttons on the overlay that I can click to "dismiss" other UI elements on the overlay.</p>
  
  <p>What I have found, and the problems with each:</p>
  
  <ol>
  <li>Setting <code>Topmost="True"</code> on the window. There is no problem with this. This does exactly what I want, it makes my window always drawn on top of other windows.</li>
  <li>Making the window background to <code>{x:Null}</code> and adding <code>AllowsTransparency="True"</code> and <code>WindowStyle="None"</code> on the Window. This allows click through allows clicking through the transparent parts, and allows clicking on buttons that are visible, however, since the click-through only works on invisible things, that's not very useful. Can never, you know, actually <em>display</em> any information on the overlay or that breaks the click-through behavior.</li>
  <li><p>Doing the above, but also setting <code>IsHitTestVisible="False"</code> on elements that I want to be able to click through. This disabled interacting with the controls using the mouse, but it doesn't allow the clicks to pass through to the window beneath it.</p></li>
  <li><p>Using the <code>SetWindowLong</code> method from <a href="https://stackoverflow.com/a/3367137/862495">this accepted answer</a>. The problem with this is that it makes the <strong>entire</strong> window click through. You are no longer able to make certain buttons on the overlay clickable.</p></li>
  <li>Using the <code>SetWindowLong</code> method from above, but pass it the <code>hwnd</code> of the button and make the button <strong>not</strong> transparent to clicks. This does not work. It's actually not even possible to do because unlike in WinForms, WPF buttons are not windows and they do not have window handles.</li>
  </ol>
  
  <p>I've tried toggling the window's extended style to not be "transparent" when the mouse is over the button and make it transparent again when the mouse leaves the button, but that also does not work because when it is set to be transparent then it also does not pick up MouseMove, MouseEnter, or MouseLeave events.</p>