WPf 中,怎么为GRID的单元格设定不同的背景色

WPf 中,如何为GRID的单元格设定不同的背景色rt[解决办法]C# codeGridGrid.RowDefinitionsRowDefiniti

WPf 中,如何为GRID的单元格设定不同的背景色
rt

[解决办法]

C# code
<Grid>   <Grid.RowDefinitions>          <RowDefinition Height="0.5*" />          <RowDefinition Height="0.5*" />   </Grid.RowDefinitions>  <Grid.ColumnDefinitions>         <ColumnDefiniton Width="0.5*"/>         <ColumnDefiniton Width="0.5*"/>  </Grid.ColumnDefinitions>  <Label Grid.Column="0" Grid.Row="0" Background="SpringGreen" ></Label>  <Label Grid.Column="0" Grid.Row="1" Background="RoyalBlue" ></Label>  <Label Grid.Column="1" Grid.Row="0" Background="Violet" ></Label>  <Label Grid.Column="1" Grid.Row="1" Background="Red" ></Label></Grid>