Non-resizable windows with windowStyle=None

38,133

Solution 1

Probably you can get desired result by: ResizeMode=
XAML object property which can take have following states:

  • NoResize - A window cannot be resized. The Minimize and Maximize buttons are not displayed in the title bar.
  • CanMinimize - A window can only be minimized and restored. The Minimize and Maximize buttons are both shown, but only the Minimize button is enabled.
  • CanResize - A window can be resized. The Minimize and Maximize buttons are both shown and enabled.
  • CanResizeWithGrip - A window can be resized. The Minimize and Maximize buttons are both shown and enabled. A resize grip appears in the bottom-right corner of the window.

Solution 2

One way to accomplish a fixed size Window while retaining the border is to set the Min[Width|Height] and Max[Width|Height] properties to be the same value. The border will still show the resize cursor, but the user will not be able to change the size of the Window.

If the fact that the border still indicates that it's resizable bothers you, the next step is to set the ResizeMode="NoResize", but then you have to start drawing your own Aero glass if you want to retain the glass edges.

Share:
38,133
Admin
Author by

Admin

Updated on February 17, 2020

Comments

  • Admin
    Admin over 4 years

    Basically, I want to create a window that looks like the following: alt text http://www.thex9.net/screenshots/2009-10-15_1347.png

    However, the window shouldn't be resizable (the one in the screenshot is) but must retain the glass border. The XAML for the window in the screenshot is as follows:

    <Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        x:Class="WpfApplication1.MainWindow"
        x:Name="Window" Title="MainWindow" WindowStyle="None">    
     <Grid x:Name="LayoutRoot"/>
    </Window>
    

    Is it possible to create a window which looks similar to the one in my screenshot but is not resizable? Any help would be very much appreciated.