Winforms can switch the ControlBox, Maximize and Minimize buttons on and off. I can't seem to find the equivalent properties to control the window ornaments in WPF. What's the correct nomenclature so I can look up this stuff in msdn?
You can change this by setting the ResizeMode of the window
EG:
ResizeMode="NoResize"
or
WindowStyle="ToolWindow"
will show no minimize/maximize buttons
Related
I need a window to stay maximized, so I use WindowState="Maximized" and ResizeMode="NoResize"> but the user can minimize it by trying to drag the window. Is there any way to disable it?
Try by setting WindowStyle="None".
In WPF, I want to add a userControl in/over titlebar in Window, like this:
The Red part is that UserControl, and the Green part is titlebar.
Now I hope to get some suggestions from you. Need to extend the Window class or just customize the style of the Window? It's better to provide source code.
You can do this by implementing your own title bar.
In order to do so set your window style to none:
WindowStyle="None"
This will mean that the window will have no control box (minimize, maximize, and close buttons) and you will need to implement your own.
You can take a look at the following links to get you started:
http://blog.magnusmontin.net/2013/03/16/how-to-create-a-custom-window-in-wpf/
http://www.codeproject.com/Articles/140267/Create-Custom-Windows-in-WPF-with-Ease
http://www.kirupa.com/blend_wpf/custom_wpf_windows.htm
How can I style the border and title bar of a window in WPF?
Good luck
You do not need to sub-class Window. You can adjust the style for Window: http://msdn.microsoft.com/en-us/library/aa969824.aspx.
In WPF, how can I hide the minimize button (only the minimize, not also the maximize...) of a window.
The code in this forum almost work for me. The behavior of that code is that it's disabled the minimize button. But, how hide it?
http://forums.silverlight.net/forums/p/222067/532926.aspx
How about disabling the resize attribute?
ResizeMode="NoResize"
I think you would have to hide the default window title and draw your own titlebar.
e.g.: C# WPF Custom Title Bar Tutorial
and Moving a WPF Window with Custom Chrome
I would like to make a small WPF app window semi-transparent and on top of other windows.
When I change settings on the top level Window it only seems to effect the contents, not the titlebar or border.
Is this possible with WPF??
Thanks
WindowStyle and AllowsTransparency are the two properties you'll have to change.
In order to have your window sit on top of all the other windows, you're going to want to set Window.Topmost to True as well. To move the window, handle one of the Mouse events on the border you added then call Window.DragMove in the event handler.
I'm not sure this is the best answer, but:
AllowsTransparency="True" WindowStyle="None"
gets rid of the title and border -- now Opacity effects everything else. I then added my own border and Close button. Now I just need some Move functionality.
AllowsTransparency seems to do the trick, but it forces WindowStyle to None.
When I change the style of my window to WindowStyle="None" and AllowsTransparency="True" I lose the inactive window visuals. Is there a trigger I can use in the XAML style that can show a hidden mask or opacity changes in the main window when another window has focus? I'd like to be able to achieve this within the XAML and not programatically.
You can change an opacity mask of window by changing OpacityMask property with trigger when Window.IsActive is true. OpacityMask is a brush so you can provide anything you want, including gradient or something more complex. If I remember correctly framework will take only alpha channel from this brush.