Disabling or hiding the minimize, maximize or close button of a WPF window

Magnus Montin

There may be situations when you want to hide or disable the minimize, maximize, or close button of a window without having to modify the style of the window in any other way. In a Windows Forms application there are the MinimizeBox and MaximizeBox boolean properties that lets you disable the minimize and maximize button of a Form respecively or hide them both (setting both of these properties to false will effectively hide both these buttons):

WindowStyle

In WPF you can indeed set the WindowStyle property of a Window to System.Windows.WindowStyle.ToolWindow to get rid of the minimize and maximize buttons completely, but the window will then look slightly different compared to when the property is set to its default value of SingleBorderWindow.

ResizeMode

You can in fact also disable the minimize button by setting the ResizeMode property of the window to CanMinimize but this will prevent the user from being…

View original post 919 more words

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s