I'm trying to set up a WPF window.
- Window should be in maximized state always
- Window cannot be moved or resized
- It should contain minimize and close button but not maximize button
I tried the following XAML code
<Window x:Class="BasicImagingStandAlone"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:myUserControl="clr-namespace:WpfUserControlLibrary;assembly=WpfUserControlLibrary"
Title="BasicImagingStandAlone" Icon="desktopicon.png" MinWidth="600" MinHeight="350" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Height="600" Width="1200" WindowState="Maximized" WindowStyle="None" ResizeMode="NoResize">
</Window>
The output of the xaml is a window in maximized state which cannot be moved or resized but with no buttons. How can i achieve all the requirments at once?
In order to touch the titlebar of the window you will have to import user32 APIs as described in this answer:
Disable Minimize Button, but Keep Cross and Maximize Buttons - WPF, C#
Also you can set the ResizeMode to CanMinimize. This will disable the maximize button. But in order to hide it you will have to use user32 apis as described above