WPF UniformGrid 空间均分
UniformGrid 在有限的空间内均分剩余的空间
<UserControl x:Class="WpfApp1.UserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WpfApp1"
mc:Ignorable="d"
d:DesignHeight="100" d:DesignWidth="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<!--UniformGrid 用于修饰部分空间元素排布-->
<!--UniformGrid 在有限的空间内均分剩余的空间-->
<UniformGrid Grid.Row="0" Grid.Column="0" Rows="3" Columns="3" Background="Violet">
<Button Width="100" Height="20" Content="按钮1"/>
<Button Width="100" Height="20" Content="按钮2"/>
<Button Width="100" Height="20" Content="按钮3"/>
<Button Width="100" Height="20" Content="按钮4"/>
<Button Width="100" Height="20" Content="按钮5"/>
<Button Width="100" Height="20" Content="按钮6"/>
<Button Width="100" Height="20" Content="按钮7"/>
<Button Width="100" Height="20" Content="按钮8"/>
<Button Width="100" Height="20" Content="按钮9"/>
</UniformGrid>
<UniformGrid Grid.Row="0" Grid.Column="1" Rows="3" Columns="2" Background="BurlyWood">
<Button Width="100" Height="20" Content="按钮1"/>
<Button Width="100" Height="20" Content="按钮2"/>
<Button Width="100" Height="20" Content="按钮3"/>
<Button Width="100" Height="20" Content="按钮4"/>
<Button Width="100" Height="20" Content="按钮5"/>
<Button Width="100" Height="20" Content="按钮6"/>
<Button Width="100" Height="20" Content="按钮7"/>
<Button Width="100" Height="20" Content="按钮8"/>
<Button Width="100" Height="20" Content="按钮9"/>
</UniformGrid>
</Grid>
</UserControl>