ProportionalStatusBar.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"
        Width="300" Height="300"
        x:Class="AvaloniaUI.ProportionalStatusBar"
        Title="ProportionalStatusBar">
    <Grid RowDefinitions="*,auto">

        <!-- 内容区(占位) -->
        <Border Grid.Row="0" Background="AliceBlue"/>

        <Border Grid.Row="1"
        BorderThickness="1"
        BorderBrush="Gray"
        Padding="6,3">

            <Grid ColumnDefinitions="*,auto,auto">

                <!-- 左侧:占剩余空间 -->
                <TextBlock Text="Left Side"
                           VerticalAlignment="Center"/>

                <!-- 可选拖动条 -->
                <GridSplitter Grid.Column="1" Margin="3"
                              MinWidth="1"
                              Background="Gray"
                              Cursor="SizeWestEast"
                              ResizeDirection="Columns"
                              VerticalAlignment="Stretch"/>

                <!-- 右侧:固定内容 -->
                <TextBlock Grid.Column="2"
                           Text="Right Side"
                           VerticalAlignment="Center"/>

            </Grid>
        </Border>
    </Grid>
</Window>

ProportionalStatusBar.axaml.cs代码

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

namespace AvaloniaUI;

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

运行效果

image

 

posted on 2026-04-13 13:47  dalgleish  阅读(4)  评论(0)    收藏  举报