AvaloniaUI 取消标题栏,无边框无最大最小化,
avaloniaui,取消,标题栏,无边,最大,最小化
·
浏览次数 : 580
小编点评
**Code:**
```csharp
using Avalonia.Controls;
public partial class MainWindow : Window
{
protected override void OnInitialized()
{
// Disable title bar
this.TitleBar.Visibility = false;
// Set decorations to None
this.SetStyle(Control.ControlStyles.All, "WindowStyle", "None");
// Set extended client area to decorations hint
this.ExtendClientAreaToDecorationsHint = true;
// Set extended client area chrome hints
this.ExtendClientAreaChromeHints = false;
// Set extended client area title bar height hint to -1
this.ExtendClientAreaTitleBarHeightHint = -1;
// Set system decorations to None
this.SystemDecorations = null;
}
}
```
**Output (Without Title Bar):**
```
```
**Output (With Decorations):**
```
```
**Note:**
* You can adjust the `Window.TitleBar` property to display a custom title bar.
* You can customize the `Window.Content` property to set the content of the window.
* The `ExtendClientAreaToDecorationsHint` and `ExtendClientAreaChromeHints` properties can be set to `true` or `false` to enable or disable decorations and chrome hints, respectively.
* The `ExtendClientAreaTitleBarHeightHint` property can be set to a negative value to disable the title bar height hint.
* The `SystemDecorations` property can be set to `None` to disable system decorations.
正文
AvaloniaUI 取消标题栏,无边框无最大最小化,
创建一个Window
控件 并且在Window中添加以下代码
ExtendClientAreaToDecorationsHint="True"
ExtendClientAreaChromeHints="NoChrome"
ExtendClientAreaTitleBarHeightHint="-1"
SystemDecorations="None"
效果如图:
运行效果如图:
与AvaloniaUI 取消标题栏,无边框无最大最小化,相似的内容: