Disable max performance in wpf window

I am trying to disable the maximize capacity (not the maximize button) in the wpf window, but nothing has worked so far.

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

I have uploaded 3 pictures to show exactly what is going on.

(however, due to not having 10 rep, I have to post links instead. Sorry about that. And I can't put all 3 links, only 2 of them, but the first one just works fine)

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

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

+3


source to share


2 answers


use the window state change event:



private void Window_StateChanged(object sender, EventArgs e)
{
    if (this.WindowState == System.Windows.WindowState.Maximized) 
    {
        this.WindowState = System.Windows.WindowState.Normal; 
    }
}

      

+3


source


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 I disable Aero Snap in the app?

+2


source







All Articles