6 c# wpf grid background-color

我试图抛弃Windows窗体,并从现在开始学习如何专业地使用WPF.上图是在Windows窗体中完成的一个表单,我想在WPF中重新创建.
这是我到目前为止的XAML:
<Window x:Class="PizzaSoftware.UI.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="297" Width="466" >
<Grid ShowGridLines="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".20*"/>
<ColumnDefinition />
<ColumnDefinition Width=".20*"/>
</Grid.ColumnDefinitions>
<Rectangle Grid.Column="0">
<Backcolor?
</Rectangle>
</Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)
这是否是正确的方法,我的意思是使用矩形.在我的Windows窗体示例中,我使用了Panel并为其提供了.BackColor属性.
什么是WPF实现这一目标的方式?
谢谢.
是的,你的方法很好.使用Fill属性设置背景颜色:
<Rectangle Grid.Column="0" Fill="Orange" />
<Rectangle Grid.Column="2" Fill="Orange" />
Run Code Online (Sandbox Code Playgroud)