上效果图:
页面代码:
<Grid x:Name="LayoutRoot" Background="White">
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Border Grid.Row="1" Background="AliceBlue">
<Grid Width="140" Height="120">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Rectangle Grid.Row="0" Fill="#FFE51D1D" > </Rectangle>
<TextBlock Grid.Row="0" HorizontalAlignment="Center" Margin="0,8,0,0">III级报警</TextBlock>
<Rectangle Fill="Orange" Grid.Row="1"> </Rectangle>
<TextBlock Grid.Row="1" HorizontalAlignment="Center" Margin="0,8,0,0">II级报警</TextBlock>
<Rectangle Fill="Yellow" Grid.Row="2"></Rectangle>
<TextBlock Grid.Row="2" HorizontalAlignment="Center" Margin="0,8,0,0">I级报警</TextBlock>
<Rectangle Fill="Green" Grid.Row="3"></Rectangle>
<TextBlock Grid.Row="3" HorizontalAlignment="Center" Margin="0,8,0,0">安全区域</TextBlock>
</Grid>
</Border>
</Grid>
</Grid>