heno Log

Avaloniaでウィンドウサイズを変更する

XAMLで指定

<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        x:Class="YourApp.MainWindow"
        Width="800" Height="600"><!-- ここでウィンドウサイズを指定 -->

    <TextBlock Text="ウィンドウサイズを変更しました"
               HorizontalAlignment="Center"
               VerticalAlignment="Center"/>
</Window>

Width プロパティでウィンドウの横幅、Height プロパティでウィンドウの高さを指定できます。

C#で指定

public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();

        Width = 800;
        Height = 600;
    }
}