Wpf – How to? WPF Window – Maximized, No Resize/Move

maximize-windowwindowwindow-resizewpf

I'm trying to make a WPF window that opens already maximized, with no resize/move (in systemmenu, nor in border). It should be maximized all the time, except when the user minimize it.

I tried to put WindowState="Maximized" and ResizeMode="CanMinimize", but when window opens, it covers the task bar (i don't want it).

I have an hook to WndProc that cancels the SC_MOVE and SC_SIZE.
I also can make this control with conditions in WndProc like "if command is restore and is minimized, restore, else, block" and so on.

But my point is if we have another way to make it.
Thankz for read guys =)

Best Answer

It is necessary to write WindowState="Maximized" ResizeMode="NoResize" in xaml of your window:

<Window x:Class="Miscellaneous.EditForm"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Edit Form" WindowState="Maximized" ResizeMode="NoResize"></Window>
Related Topic