方案: 使用Rectangle填充,Rectangle的属性设置如下:HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" Stroke="#FF008BFF"

Demo:

<Border Height="480" Width="640"  BorderBrush="#FFFF0000" BorderThickness="2,2,2,2">

  <Grid x:Name="LayoutRoot">
  <Grid.ColumnDefinitions>
  <ColumnDefinition Width="1*"/>
  <ColumnDefinition Width="1*"/>
  </Grid.ColumnDefinitions>
  <Grid.RowDefinitions>
  <RowDefinition Height="1*"/>
  <RowDefinition Height="1*"/>
  </Grid.RowDefinitions>
  <Rectangle HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" Stroke="#FF008BFF"/>
  <Rectangle HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" Stroke="#FF008BFF" Grid.Column="1"/>
  <Rectangle HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" Stroke="#FF008BFF" Grid.Row="1"/>
  <Rectangle HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" Stroke="#FF008BFF" Grid.Row="1" Grid.Column="1"/>
    </Grid>
  </Border>

相关文章:

  • 2021-12-23
  • 2021-09-11
  • 2021-12-18
  • 2021-08-27
  • 2021-09-02
  • 2021-08-21
  • 2022-01-12
猜你喜欢
  • 2022-12-23
  • 2021-09-04
  • 2022-01-15
  • 2021-12-29
  • 2021-10-28
  • 2021-12-27
  • 2021-12-11
相关资源
相似解决方案