本文演示C#WPF嵌套布局实例。演示了不同布局的简单用法,便于快速应用和掌握。
<Window
x:Class="LayoutDemo.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:local="clr-namespace:LayoutDemo"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="MainWindow"
Width="600"
Height="400"
FontSize="15"
mc:Ignorable="d">
<!-- 网格面板提供了一个由行和列组成的灵活区域。在 Grid 中,子元素可以以表格形式排列。 -->
<Grid Background="White">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />