0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

消したかったんですよ。

ウィンドウのタイトルバーを消したい

以前にAvalonia UIでウィンドウのタイトルバーを消す記事を書きました。

そしてこうも書きました。

UIフレームワークも最新バージョン使うようにしような!

します。

Avaloniaのバージョンを11.3.6から12.0.4にアップデート

The property 'ExtendClientAreaChromeHints' does not exist on 'Avalonia.Controls.Window'.

なんやて!?

ExtendClientAreaChromeHintsがないというエラーが起きてしまいました。

修正は結局1行

もったいぶる必要ありませんね、結果を先に書きましょう。

MainWindow.axaml
 <Window xmlns="https://github.com/avaloniaui"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
         x:Class="AvaloniaHideTitleBarSample.MainWindow"
         ExtendClientAreaToDecorationsHint="True"
-        ExtendClientAreaChromeHints="NoChrome"
+        WindowDecorations="BorderOnly"
         CanMaximize="False"
         CanMinimize="False"
         Title="AvaloniaHideTitleBarSample">
     Welcome to Avalonia!
 </Window>

タイトルバーのないウィンドウ

出来上がりは以前と変わりないため画像は使いまわしてます。

コード全文は以下のリポジトリ…の、12.0.4ブランチ。

何が起きたか?

メジャーバージョンアップによる破壊的変更です。

The Window.ExtendClientAreaChromeHints property consisted of several flags that were not always behaving as expected. This property has been removed, as the WindowDecorations property in conjunction with ExtendClientAreaToDecorationsHint should be used instead.

ExtendClientAreaChromeHintsは削除したので代わりにWindowDecorationsExtendClientAreaToDecorationsHintと一緒に使えとのことです。
ExtendClientAreaToDecorationsHintは元から使っていたので、WindowDecorationsだけの変更となりました。

せっかくなので他のWindowDecorations

WindowDecorations="Full"

WindowDecorations="Full"のウィンドウ

WindowDecorations="Full"だといつもの普通のウィンドウですね。
ExtendClientAreaToDecorationsHint="True"の影響でコンテンツがタイトルまで侵入していて見た目がキモいですが、その程度です。
ちなみに、右から4番目の斜め矢印ボタンは、最大化してタイトルバーを取っ払うフルスクリーン機能のようです。

WindowDecorations="None"

タイトルバーどころか外枠全部ないウィンドウ

WindowDecorations="None"は枠ごと消えます。
以前のSystemDecorations="None"と同じ結果なので、画像は使いまわしています。

環境

  • Visual Studio 2026 Community Version: 18.7.0
  • Avalonia UI 12.0.4
  • Windows 11

おわりに

UIフレームワークの最新バージョン使うときは気を付けような!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?