XAML文件内容
cs
<Window x:Class="Wpf_demo1.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:Wpf_demo1"
mc:Ignorable="d"
Title="我爱学编程" Height="450" Width="800">
<!--x:Class="Wpf_demo1.MainWindow"这里的MainWindow名称与.xaml.cs上的public partial class 名称相同-->
<!--上述区域代表非客户区,正常来说只能修改Title的属性-->
<!--<Grid>
-->
<!--Grid区域代表客户区-->
<!--
<Button Width="122" HorizontalAlignment="Right" Margin="0,70,606,244"/>
<Button Width="122" HorizontalAlignment="Left" Margin="476,217,0,97"/>
</Grid>-->
<Grid ShowGridLines="True">
<Grid.RowDefinitions><!--将整个页面分成4行-->
<RowDefinition Height="20"/>
<RowDefinition Height="20"/>
<RowDefinition/>
<RowDefinition Height="20" />
</Grid.RowDefinitions>
<!--定义了第一行的内容-->
<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal">
<Button Height="20" Width="70" Content="文件"/>
<Button Height="20" Width="70" Content="编辑"/>
<Button Height="20" Width="70" Content="查看"/>
<Button Height="20" Width="70" Content="外观"/>
<Button Height="20" Width="70" Content="设置"/>
<Button Height="20" Width="70" Content="帮助"/>
</StackPanel>
<!--定义了第二行的内容-->
<StackPanel Grid.Row="1" Grid.Column="0" Orientation="Horizontal">
<Button Height="20" Width="70" Content="1"/>
<Button Height="20" Width="70" Content="2"/>
<Button Height="20" Width="70" Content="3"/>
<Button Height="20" Width="70" Content="4"/>
<Button Height="20" Width="70" Content="5"/>
<Button Height="20" Width="70" Content="6"/>
</StackPanel>
<!--定义第三行第一列的内容-->
<Grid Grid.Row="2" Grid.Column="0" Background="Aqua">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="70" />
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel>
<Button Height="20" Content="1"/>
<Button Height="20" Content="3"/>
<Button Height="20" Content="5"/>
<Button Height="20" Content="7"/>
<Button Height="20" Content="9"/>
</StackPanel>
<!--定义第三行第二列为输入文本-->
<TextBox Grid.Row="0" Grid.Column="1" TextWrapping="Wrap"/>
</Grid>
<!--定义最后一行的内容-->
<Grid Grid.Row="3" Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button Grid.Row="0" Grid.Column="0" Content="行"/>
<Button Grid.Row="0" Grid.Column="1" Content="列"/>
<Button Grid.Row="0" Grid.Column="2" Content="字符"/>
<Button Grid.Row="0" Grid.Column="3" Content="求值"/>
<Button Grid.Row="0" Grid.Column="4" Content="选定"/>
<Button Grid.Row="0" Grid.Column="5" Content="选行"/>
<Button Grid.Row="0" Grid.Column="6" Content="匹配"/>
</Grid>
</Grid>
</Window>