如何去除 UWP 中 viewbox 的奇怪间距?

How to remove strangly spacing of viewbox in UWP?

这里是 XAML:

<Page
    x:Class="App1.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:App1"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    Background="Black">

    <Grid>
        <Viewbox Margin="20">
            <Grid Background="Black">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="50"></ColumnDefinition>
                    <ColumnDefinition Width="1000"></ColumnDefinition>
                    <ColumnDefinition Width="50"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Polygon Fill="White" Points="0,50,50,0,50,50"/>
                <Rectangle Fill="White" Grid.Column="1"></Rectangle>
            </Grid>
        </Viewbox>
    </Grid>
</Page>


当应用程序运行时,多边形和矩形之间出现奇怪的 1px 间距,如下所示:


更重要的是,我发现如果我删除viewbox,问题就解决了。

这有什么问题,我怎样才能删除 this.Thank 你奇怪的 1px 间距。

我认为这是由于一些Computer Vision theory我们不理解。

但是一个快速的解决方法是给矩形添加负边距,让它变大一点以隐藏 1px 线。

<Rectangle Fill="White" Grid.Column="1" Margin="-1"></Rectangle>