❔ Making WPF window click thru / unclickable?
I have a overlay window, which is on top of some other programs, but right now, if you click on the overlay part on the window, it will try to focus the overlay and start blinking, and you will loose control of the program the overlay is on top off. So how do I make the overlay click thru or unclickable?
Thanks
3 Replies
There are various ways to do this.
The simplest I can think of right now is
window.IsHitTestVisible = false;
Let me know if this works for you!
If not, you could go a PInvoke route and set it using windows apis
I'll post the alternative anyway
To get a window handle you can use
to get a window handle and then use PInvoke's SetWindowLong to set the respective flags:
Here in the example i'm using the Vanara.PInvoke.User32
nuget package though you don't need to use a package as all the enums can be marshalled as ints and methods can be added via [LibraryImport]
eg. for SetWindowLong:
Note, your class thas has this method would also have to be partial
(source code generation occurs)
Thanks, I'm gonna try it out 🙂
Hm, can't get either of them to work
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.