Is it possible to disable the automatic window-docking feature of Windows 7 in a WPF application?
I needed to detect Windows 7 Aero snaps/docks to prevent window-size changes on a WPF application. During my search, I stumbled upon this post and found the answer given by anthony very helpful.
Following is what worked for me.
private void DisplayWindow_MouseMove(object sender, MouseEventArgs e)
{
if (e.LeftButton == MouseButtonState.Released)
{
this.ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip;
}
}
private void DisplayWindow_LocationChanged(object sender, EventArgs e)
{
this.ResizeMode = System.Windows.ResizeMode.NoResize;
}
The window's XAML had the ResizeMode="CanResizeWithGrip" setting.
Edit:
My response was not handle the Windows 7 Aero snap properly. bjo's response elegantly solved the problem for me.