如何使用绝对路径数据扩展子画布以适应WinRT XAML中的父控件?

如何使用绝对路径数据扩展子画布以适应WinRT XAML中的父控件?,xaml,windows-runtime,Xaml,Windows Runtime,我们收到了一个Adobe Illustrator文件,该文件已导入到Expression Blend for VS2013中,并转换为XAML for Windows应用商店应用程序 <Grid Width="300" Height="300"> <Canvas> <Path Data="F1M2.128,17.024L15.606,17.024 15.606,1.418C15.606,0.635,14.971,0,14.188,0L1.41

我们收到了一个Adobe Illustrator文件,该文件已导入到Expression Blend for VS2013中,并转换为XAML for Windows应用商店应用程序

<Grid Width="300" Height="300">
    <Canvas>
        <Path Data="F1M2.128,17.024L15.606,17.024 15.606,1.418C15.606,0.635,14.971,0,14.188,0L1.418,0C0.635,0,0,0.635,0,1.418L0,18.443C0,19.226,0.635,19.862,1.418,19.862L14.188,19.862C14.971,19.862,15.606,19.226,15.606,18.443L2.128,18.443C1.736,18.443 1.418,18.126 1.418,17.734 1.418,17.341 1.736,17.024 2.128,17.024" Fill="White" Height="19.862" Canvas.Left="11.797" Stretch="None" Canvas.Top="9.651" Width="15.606"/>
        <Path Data="F1M19.499,3.44C11.148,3.44 3.44,11.147 3.44,19.499 3.44,27.85 11.148,35.558 19.499,35.558 27.852,35.558 35.56,27.85 35.56,19.499 35.56,11.147 27.852,3.44 19.499,3.44 M19.499,38.999C8.748,38.999 0,30.252 0,19.499 0,8.747 8.748,0 19.499,0 30.252,0 39,8.747 39,19.499 39,30.252 30.252,38.999 19.499,38.999" Fill="White" Height="38.999" Canvas.Left="0" Stretch="None" Canvas.Top="0" Width="39"/>
        <Path Data="F1M0.692,4.354C0.849,4.101 1.045,3.851 1.282,3.604 1.517,3.356 1.802,3.132 2.136,2.934 2.468,2.734 2.79,2.568 3.232,2.436 3.675,2.304 4.184,2.224 4.757,2.199L4.757,-0.001 9.118,3.394 4.757,6.738 4.757,4.31C4.612,4.31 4.421,4.314 4.181,4.324 3.944,4.332 3.679,4.358 3.386,4.402 3.094,4.444 2.854,4.508 2.532,4.594 2.211,4.68 1.894,4.798 1.584,4.952 1.272,5.104 0.98,5.274 0.707,5.502 0.433,5.732 0.197,6.012 0,6.342 0.093,5.598 0.324,4.949 0.692,4.354" Fill="#FF040707" Height="6.739" Canvas.Left="15.573" Stretch="None" Canvas.Top="14.641" Width="9.118"/>
    </Canvas>
</Grid>


我们想要的是拉伸画布,使其填充父网格。

您可以将
画布
尺寸设置为图形的精确尺寸,然后将其放入
视图框中:

    <Grid Width="300" Height="300">
        <Viewbox>
            <Canvas Width="39" Height="38.999">
                <Path Data="F1M2.128,17.024L15.606,17.024 15.606,1.418C15.606,0.635,14.971,0,14.188,0L1.418,0C0.635,0,0,0.635,0,1.418L0,18.443C0,19.226,0.635,19.862,1.418,19.862L14.188,19.862C14.971,19.862,15.606,19.226,15.606,18.443L2.128,18.443C1.736,18.443 1.418,18.126 1.418,17.734 1.418,17.341 1.736,17.024 2.128,17.024" Fill="White" Height="19.862" Canvas.Left="11.797" Stretch="None" Canvas.Top="9.651" Width="15.606"/>
                <Path Data="F1M19.499,3.44C11.148,3.44 3.44,11.147 3.44,19.499 3.44,27.85 11.148,35.558 19.499,35.558 27.852,35.558 35.56,27.85 35.56,19.499 35.56,11.147 27.852,3.44 19.499,3.44 M19.499,38.999C8.748,38.999 0,30.252 0,19.499 0,8.747 8.748,0 19.499,0 30.252,0 39,8.747 39,19.499 39,30.252 30.252,38.999 19.499,38.999" Fill="White" Height="38.999" Canvas.Left="0" Stretch="None" Canvas.Top="0" Width="39"/>
                <Path Data="F1M0.692,4.354C0.849,4.101 1.045,3.851 1.282,3.604 1.517,3.356 1.802,3.132 2.136,2.934 2.468,2.734 2.79,2.568 3.232,2.436 3.675,2.304 4.184,2.224 4.757,2.199L4.757,-0.001 9.118,3.394 4.757,6.738 4.757,4.31C4.612,4.31 4.421,4.314 4.181,4.324 3.944,4.332 3.679,4.358 3.386,4.402 3.094,4.444 2.854,4.508 2.532,4.594 2.211,4.68 1.894,4.798 1.584,4.952 1.272,5.104 0.98,5.274 0.707,5.502 0.433,5.732 0.197,6.012 0,6.342 0.093,5.598 0.324,4.949 0.692,4.354" Fill="#FF040707" Height="6.739" Canvas.Left="15.573" Stretch="None" Canvas.Top="14.641" Width="9.118"/>
            </Canvas>
        </Viewbox>
    </Grid>

没问题,很高兴我能帮忙:)