Julian David Bautista Osorio Julian David Bautista Osorio - 2 months ago 21
C# Question

disable maximize capacity in a wpf window

I'm trying to disable the maximize capacity (not the maximize button) in a wpf window, but so far nothing has succeded.

I'm using a window with WindowStyle="none", but when I drag the window to the far top of the screen, the OS "maximizes" the window (terribly bad, by the way).

I uploaded 3 pictures to show what is happening exactly.

(however, due to the fact that I don't have 10 reputation, I have to post the links instead. Sorry about that. And I can't put all 3 links, only 2 of them, but the first one is just of the window working normally)

During:
http://i58.tinypic.com/243lr89.jpg

After:
http://i62.tinypic.com/f3c1mu.jpg

Answer

Set MaxHeight,MinHeight and MaxWidth,MinWidth property for the window.

Example

 <Window x:Class="test.MainWindow"        
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"                
    Title="MainWindow" MaxHeight="350" MaxWidth="525" MinHeight="350" MinWidth="525">
</Window>

How do you disable Aero Snap in an application?