下面的代码将在 windows phone 上的平铺矩形之间显示细线。我尝试将 UseLayoutRounding 设置为 true,但似乎没有做任何事情。当使用设备(在我的例子中是 lumina 920)而不是模拟器运行代码时,会有更多细线,但 720p 模拟器似乎在这方面遇到了更多麻烦。是否有一个我错过的简单属性可以解决这个问题?我现在使用矩形缩放到 1.1 来隐藏线条,但不是一个优雅的解决方案,特别是如果矩形变成半透明,那么重叠区域上有亮点。
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0" UseLayoutRounding="True" >
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Rectangle Fill="White" Grid.Row="0" Grid.Column="0" StrokeThickness="0" />
<Rectangle Fill="White" Grid.Row="1" Grid.Column="0" StrokeThickness="0" />
<Rectangle Fill="White" Grid.Row="2" Grid.Column="0" StrokeThickness="0" />
<Rectangle Fill="White" Grid.Row="0" Grid.Column="1" StrokeThickness="0" />
<Rectangle Fill="White" Grid.Row="1" Grid.Column="1" StrokeThickness="0" />
<Rectangle Fill="White" Grid.Row="2" Grid.Column="1" StrokeThickness="0" />
<Rectangle Fill="White" Grid.Row="0" Grid.Column="2" StrokeThickness="0" />
<Rectangle Fill="White" Grid.Row="1" Grid.Column="2" StrokeThickness="0" />
<Rectangle Fill="White" Grid.Row="2" Grid.Column="2" StrokeThickness="0" />
<Rectangle Fill="White" Grid.Row="3" Grid.Column="0" StrokeThickness="0" />
<Rectangle Fill="White" Grid.Row="3" Grid.Column="1" StrokeThickness="0" />
<Rectangle Fill="White" Grid.Row="3" Grid.Column="2" StrokeThickness="0" />
</Grid>