Question

I have a WPF application that uses a custom window frame. My problem is that I cannot "unsnap" my maximized window with Aero Snap in Windows 7.

Properties of my window:

  • AllowsTransparency is set to true
  • WindowStyle is set to None
  • ResizeMode is set to CanResizeWithGrip.

I handle window drag movement like so:

private void TitleBarGrid_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
    DragMove();
}

I can dock the window to the left, to the right, and to the top, and have it behave like normal windows (expand to fill left half of screen, expand to fill right half of screen, maximized, respectively).

I'm not sure how Aero Snap works, but what I find odd is that normal WPF windows (non-custom windows) work just fine; I can unsnap them if they are maximized without a problem. Why then does applying the above properties to my window break that?

Is it possible I need to do some custom WM message handling to make this work?

Was it helpful?

Solution

I ended up just using the WPF Shell Integration Library from Microsoft. It handles all of the low-level magic necessary to make Aero Snap work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top