Reputation: 47
I want to hide the maximize and minimize button, it's worked when set IsMaximizable and IsMinimizable to false, but when I want to custom title bar by adding: this.ExtendsContentIntoTitleBar = true;
, those buttons cannot be hidden anymore.
Is there a way to deal with this?
Upvotes: 0
Views: 1346
Reputation: 25
An update for you, in your Window constructor you can use these Window class extensions:
SetIsMaximizable(false), SetIsMinimixable(false) and this.SetIsResizable(false)
public MainWindow() {
this.InitializeComponent();
this.SetIsResizable(false);
this.SetIsMaximizable(false);
this.SetIsMinimizable(false)
}
Upvotes: 0
Reputation: 13666
Check the WinUI Ex NuGet package from dotMorten. You can easily hide those buttons with these lines.
using Microsoft.UI.Xaml;
using WinUIEx;
namespace WinUIExTest;
public sealed partial class MainWindow : Window
{
public MainWindow()
{
this.InitializeComponent();
WindowManager.Get(this).IsMinimizable = false;
WindowManager.Get(this).IsMaximizable = false;
}
}
Upvotes: 0