1

Im using a WPF Window in the WindowsStyle='none';

With this I create my own custom window by giving the 'root' grid (the highest in the XAML-tree) a Margin of 20px and a DropShadow. The window itself is transparant, the grid has a white background.

When I set the WindowsStyle.Maximized, I remove the extra Margin and the DropShadow . When I set WindowsStyle.Normal I add the extra Margin and the DropShadow again.

But when I snap my WPF window in Windows 10 to a corner or side of my screen. It snaps but I dont get an Window.StateChanged event.

My question is: Is there anyway to figure out when my Window has snapped in Windows and when it Unsnapped?

MiiChiel
  • 201
  • 1
  • 4
  • 14
  • 3
    The Windows "aero snap" feature that is built into the OS does not expose any snap/unsnap events that you can use in WPF or any Win32 apps. However, the result of these snaps are a window resize. So you might be better off listening to the `Window.SizeChanged` event instead of `Window.StateChanged` for your needs. – Tam Bui Jul 22 '21 at 18:40
  • Thanks, I think that would do it because I know code wise when the user resizes the window by pulling on the sides of the window... – MiiChiel Jul 26 '21 at 12:46

0 Answers0