SimpleGrid.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" Height="300" Width="300"
        x:Class="AvaloniaUI.SimpleGrid"
        Title="SimpleGrid">
    <Grid ShowGridLines="True" RowDefinitions="*,*" ColumnDefinitions="*,*,*">
        <Button Grid.Row="0" Grid.Column="0">Top Left</Button>
        <Button Grid.Row="0" Grid.Column="1">Middle Left</Button>
        <Button Grid.Row="1" Grid.Column="2">Bottom Right</Button>
        <Button Grid.Row="1" Grid.Column="1">Bottom Middle</Button>
    </Grid>
</Window>

SimpleGrid.axaml.cs代码

using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;

namespace AvaloniaUI;

public partial class SimpleGrid : Window
{
    public SimpleGrid()
    {
        InitializeComponent();
    }
}

运行效果

 

posted on 2025-07-10 14:01  dalgleish  阅读(21)  评论(0)    收藏  举报