【发布时间】:2018-10-10 11:04:34
【问题描述】:
我尝试加载一些具有相同结果的 SVG 文件:它们呈现剪裁,并且似乎忽略了布局。
例如:
<UserControl
x:Class="SuppaFlight.UWP.AnglesControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="1000">
<Image Source="Assets/treeicon.svg" Stretch="UniformToFill" />
</UserControl>
这样渲染,忽略Stretch 设置:
那里发生了什么?这是一个已知问题吗?如何解决这个问题?
【问题讨论】:
-
你可以使用这个技巧来解决问题stackoverflow.com/a/44216273/713789
-
如果您可以修改 SVG 文件,那么上面链接中的第三个答案最适合我(修改 SVG 以在 XAML 中自动缩放)