0

I created a WPF application that has an overlay mode. In this mode, the whole application gets semi transparent. I'd now like to be able to click through this window to operate with elements behind it [other program UI's, desktop icons etc.]

I wonder if there is the possibility to configure the window right away to represent this behaviour. I set up my application window like this:

WindowStyle="None" AllowsTransparency="True" Opacity="0.5" Background="Black" IsHitTestVisible="True" Focusable="True" IsTabStop="False"

If I set the Background to x:Null or Transparent, I can click through the application. However, the application is not visible at all any more then.

If this is not possible directly, I thought about another solution: When clicking on the Application, minimize it, execute another mouse click, and then maximize the application. I found some example code for a global mouse click which looks like this:

MouseEventArgs e = new MouseEventArgs(Mouse.PrimaryDevice, 0);
e.RoutedEvent = Mouse.MouseEnterEvent;
youUIElement.RaiseEvent(e);
// Or
InputManager.Current.ProcessInput(e);

However, I think this will not work when trying to do double-clicks.

So, general desire in a few words: Semi-transparent WPF application, always on top, click-through. Also Keyboard input should pass through. I set up a special hotkey that brings the application back.

Any helps / ideas?

  • It looks like that process will only work if the window is transparent, see [this msdn question](https://social.msdn.microsoft.com/Forums/en-US/a5e3cbbb-fd07-4343-9b60-6903cdfeca76/click-through-window-with-image-wpf-issues-httransparent-isnt-working?forum=csharplanguage) You could possibly have the window transparent but a lone child border within it that you set the background property to and borderthickness as 0. Worth a try. – CalebB Jul 16 '15 at 13:31
  • Nope, can't click through the border. –  Jul 16 '15 at 13:35
  • Yeah I figured that would be the case, what's your intended result from clicking through the window? – CalebB Jul 16 '15 at 13:52
  • I kind of want to have an overlay that explains certain elements underneath without interfering with the user input. –  Jul 16 '15 at 14:03
  • Like dialog boxes that explain a control or what? A simple solution for that is the tooltip, an html-like mouse-over box giving help text on the control they are hovering over. – CalebB Jul 16 '15 at 14:09
  • But the program I want the tool tip for is not written by me. It's an external program and I want to program an overlay for it. Kinda like a helper mask on top of the program. –  Jul 16 '15 at 14:42
  • There's so many variables to content with there, how are you determining what they are clicking on in the first place? The under window would be a different shape of the screen could have a strange resolution, hard coding variables on where stuff is would practically be impossible. You could have a gradient border to with a transparent background to show the app is active but the actual functionally is another matter. – CalebB Jul 16 '15 at 14:48

0 Answers0