当前位置: 代码迷 >> .NET Framework >> WPf 中,怎么为GRID的单元格设定不同的背景色
  详细解决方案

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

热度:48   发布时间:2016-05-02 00:15:52.0
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>