Grid是个强大的网格面板,让我们可以输入更多的列和行,成为一个真正的表格布局。
<Window x:Class="WpfApp.WindowGrid"
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:WpfApp"
mc:Ignorable="d"
Title="WindowGrid" Height="450" Width="800">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="2*" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<Button>Button

本文介绍了WPF中的Grid面板,展示了如何创建包含三行三列的布局,并利用星形(*)和Auto模式设定宽高比例。通过实例说明了按钮与不同宽度设置的结合使用,以及GridSplitter在调整行列大小中的作用。

636

被折叠的 条评论
为什么被折叠?



