WPF GridSpitter SharedSizeGroup

<Window x:Class="WpfApp330.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        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"
        xmlns:local="clr-namespace:WpfApp330"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid IsSharedSizeScope="True">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" SharedSizeGroup="myGroup"/>
            <ColumnDefinition/>
            <ColumnDefinition SharedSizeGroup="myGroup"/>
        </Grid.ColumnDefinitions>
        <Label Grid.Column="0" Background="Red"
               HorizontalContentAlignment="Center" VerticalContentAlignment="Center">1</Label>
        <GridSplitter Grid.Column="0" Width="5"/>
        <Label Grid.Column="1" Background="Orange"
               HorizontalContentAlignment="Center"
               VerticalContentAlignment="Center">2</Label>
        <Label Grid.Column="2" Background="Yellow"
               HorizontalContentAlignment="Center"
               VerticalContentAlignment="Center">3</Label>
    </Grid>
</Window>

 

 

 

 

 

 

 

posted @ 2024-09-03 16:34  FredGrit  阅读(17)  评论(0)    收藏  举报