Click here to Skip to main content
15,945,939 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
Hi everybody!

How can I keep all parts of a window running a WPF application visible at all times. I want to prevent that moving or resizing this window will make some parts go outside the desktop's boundaries making them invisible.
Like sticky window, but its different!

Any help on this is appreciated.

Thanks for your consideration!

Updated 3-Oct-11 6:28am
Manfred Rudolf Bihy 3-Oct-11 9:36am    
Can you please explain in more detail what it is you're trying to achieve?
What is it exactly you're trying to prevent from happening?
Are you working in an extended desktop environment (more than one display for one desktop)?
From where are you moving the window into the desktop space?
hzawary 3-Oct-11 10:37am    
Thank you for attention. very simply: A normal desktop and (WPF) window run through it; I want with moving it (in desktop space) the all window stay in view (bounding window to desktop).
Manfred Rudolf Bihy 3-Oct-11 10:42am    
So you want to prevent that any part of the window is moved outside of the desktop's boundaries, if I understood you correctly?
If that is the case I can edit your question so it more clearly reflects of what you're trying to do. What about the scenario I mentioned where there is more than one display. Displays can run at different resolutions and can be positioned relatively to one another (vertical alignement)?
hzawary 3-Oct-11 11:08am    
Oh yeah, it's Goal!
Thank you ;)
Finally, one could understand me!

1 solution

My advice to you would be to hook into the window's WindowProc. Here's an article on how to do that:[^]. Then if the window gets moved or resized you can intercept the messages to extract that information. By detecting your desktop geometry you will be able to tell if a move or a resize is possible to/at the current position of your window.

Best Regards,

Share this answer
hzawary 3-Oct-11 11:18am    
May worked it if WindowStyle set to None? (without window border)
May you more guide me? (it is a little difficult)
Member 3093844 26-Feb-15 12:30pm    
did you ever find a solution to this. I was trying to do it with clipcursor but that only works withing the confines of the wpf window. I'm trying to do similar to what your doing.
Manfred Rudolf Bihy 26-Feb-15 13:01pm    
You should ask the original poster of the question. This was just my advice of what could be tried to solve this.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900