.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

WPF Custom Window: cannot "unsnap" maximized window with Win7 Aero Snap

Posted By:      Posted Date: October 13, 2010    Points: 0   Category :WPF
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:


 sender, System.Windows.Input.MouseButtonEventArgs e)


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?

View Complete Post

More Related Resource Links

Handling WindowState.Maximized on custom Window (when taskbar docked on top or left)


I am customizing a window by setting my WindowStyle=None. When I first start the application, everything works great if the Taskbar is docked on the bottom or right side of my monitor. However, if it is docked on the top or left, my WindowState.Maximized look is messed up. Here is the code that is handling my work area on initialization. Any help is much appreciated.

using System;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Interop;
using System.Windows.Media;

namespace Test
  /// <summary>
  /// Interaction logic for Testing.xaml
  /// </summary>
  public partial class Testing: Window
    #region Constructor(s)
    public Testing()
      this.SourceInitialized += new EventHandler(Testing_SourceInitialized);


    #region Window Sizing

    //Nearest monitor to window

    //To get a handle to the specified monitor
    static extern IntPtr MonitorFromWindow(IntPtr hwnd, int dwFlags);

    //Rectangle (used by MONITORINFOEX)
    public struct RECT
      public int Left;
      public int Top;
      public int Right;
      public int Bottom;

    //Monitor information (used by GetMonitorInfo())

Aero Glass: Create Special Effects With The Desktop Window Manager


In this article we introduce the Desktop Window Manager, the new interface that manages how windows are rendered on the Windows Vista desktop.

Ron Fosner

MSDN Magazine April 2007

Windows UI: Our WinMgr Sample Makes Custom Window Sizing Simple


Programmers using Visual Basic have always had an advantage over C++ programmers when it comes to component and window sizing. There are many third-party Visual Basic-based solutions to this age-old problem, but unfortunately, there are few elegant alternatives for the C++ crowd, short of using a full-fledged windowing toolkit. This article explains how to circumvent the tedious task of hardcoded pixel arithmetic. It starts by introducing a window sizing rules system, and then moves on to show how CWinMgr, a data-driven class, can intelligently manage an MFC application's window sizing.

Paul DiLascia

MSDN Magazine July 2001

Open a link in new window from a custom fields description MOSS 2007



I have kept a help link (ex: http://www.msdn.com) under a document library field's description. i want this link to be opened in a new window with out navigating from that page.

any ideas greatly appreciated.




How to implement Design-Time drag & drop from Custom Visual Studio Tool Window to WPF Designer

Hi, Could someone tell me if it is possible to intercept a design time drop event coming from a custom Visual Studio tool window onto the cider design surface? I am hoping to use the same API's as those used by the Visual Studio 2010 'Data Sources' tool window, which provides drag & drop data-binding between classes and WPF/Silverlight controls. My requirement is to pass a DataObject (used with the WPF DragDrop API) from my custom Visual Studio WPF tool window treeview to my custom WPF control at design time, read the data and do some binding/XAML manipulation of my own. The drag aspect is simple enough but I can't work out how to accept a drop event from anything other than the toolbox. At the moment, when I drag my treenode over the design surface it shows the 'cannot drop here' cursor. If someone could give me some insight into how the 'Data Sources' tool window allows dragging of treenodes to controls I would really appreciate it. It is obviously possible but which API's are used and are they public? Thanks in advance, Paul  

Modal popup window in ASP.Net

A Masked div or modal popup window is a child window created from the parent window which prevents the user from interacting with parent window before he returns to the parent application.

lossing focus from model pop up window controls


hi i using a model pop up window with some textbox but when i click on textbox of model pop up focus move to back to page textbox control plz help me 

Open PopUp Window From Error httpModule


I would like to open a popup window from the assembly to present the information to the user. Does anyone know if this is possible, I am presently doing the following:

        WriteLine("body {font-family:""Verdana"";font-weight:normal;font-size: .7em;color:black; background-color:white;}")
        WriteLine("b {font-family:""Verdana"";font-weight:bold;color:black;margin-top: -5px}")
        WriteLine("H1 { font-family:""Verdana"";font-weight:normal;font-size:18pt;color:red }")
        WriteLine("H2 { font-family:""Verdana"";font-weight:normal;font-size:14pt;color:maroon }")
        WriteLine("pre {font-family:""Lucida Console"";font-size: .9em}")

Create a user friendly pop up window


Hello friends I am new to asp.net programming. While working with windows form(windows application) i have created a window for editing purpose(just like popup window ) which contains three bounded dropdown list a button and a gridview. After making selections from the drop down when we press button the corresponding result should display in a grid.After that when you click on the grid row it will load the corresponding datas in my form. i want to create such control in asp.net . i have to use jquery or ajax.And this pop up window i have to use more than twenty times in my application.am using VS2008 ASP.NET and C# 3.5 . Plese suggest me what to do. Thanks in advance

problem in consuming WCF service through Window application


I have a silverlight application and WCF service all made in VS 2010 , i had hosted my site to web server which contain Window 2008 and IIS 7.0

now the problem is i have another application which is a window application developed in VS2008 , when i try to add the service reference it gives me error


The document at the url was not recognized as a known document type.

The error message from each known type may help you fix the problem:

- Report from 'DISCO Document' is 'There was an error downloading 'http://dev_qa.emspa.com/HRDev3/Service.svc?disco'.'.

  - The request failed with HTTP status 400: Bad Request.

- Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

- Report from '' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

- Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

Metadata contains a reference that cannot be resolved: ''.

Content Type application/soap+xml; charset

Crystal Report parameter value window.


 Hi friends,

   I am using Crystal report which displays the result of stroed procedure which have 2 paramater.

  When i run report it shows two window for getting each parameter.

  My need is, can i have one window for getting all the paramter value for stored procedure.


  With Advanced thanks,






C++ Q&A: Window Destruction in the .NET Framework


If a window is destroyed, does the .NET Framework immediately destroy the corresponding Form, or does it wait until a garbage collection to do this? How can you release my resources as soon as the window is destroyed? This month Paul DiLascia gives you the answers.

Paul DiLascia

MSDN Magazine May 2003

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend