Hello all,
I would like to be able to remove the ControlBox in the top-left corner of the Window using either XAML or C# - the border style is not an option as I would like to keep the maximize, minimize and close buttons on the right-corner of titlebar.
Please could someone point me in the right direction about how to do this? I would like to remove just the controlbox and leave everything else as is, in WinForms I could just do:
ControlBox = False;
Thanks,
VulpesPosted Mar 5, 2015, 5:00 PM
If you set the ControlBox property to false in a Windows Forms application, then it does in fact remove the buttons as well, not just the ControlBox.
However, you can remove the ControlBox and buttons without removing the border in WPF with code such as this:
using System.Runtime.InteropServices;
VulpesPosted Mar 5, 2015, 6:37 PM
If you set WindowStyle to None so WPF doesn't render the Title Bar, you can then draw your own with just the buttons you want on it.
Although it's answering a slightly different question, the code by the Microsoft poster in this thread should help you with this:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/fe5b10b0-cf51-4232-90be-b87b3d679f89/showing-a-help-button-in-a-wpf-window-title-bar?forum=wpf
SwattoPosted Mar 5, 2015, 5:30 PM
SwattoPosted Mar 5, 2015, 8:37 AM
Tom MohanPosted Mar 5, 2015, 7:53 AM
WindowStyle="none"
If its useful, mark it as "Accepted Answer"