我可以将复合形状作为WinRT XAML中的资源吗? [英] Can I have a composite shape as a resource in WinRT XAML?
问题描述
我正在开发Windows 8 Metro风格的应用程序,并且我想使用矢量图像.由于似乎没有对svg图像的直接支持,因此我尝试使用由多个形状(路径和一些线)组成的xaml片段作为图像.我想要一个具有复合形状的资源字典条目,并能够将其包含在不同的页面中.理想情况下,我还希望能够从数据绑定属性中解析特定的复合形状.
I'm developing a Windows 8 Metro-style application and I want to use vector images. As there seems to be no direct support for svg images, I am trying to use a xaml fragment consisting of multiple shapes (a path and some lines) as an image. I would like to have a resource dictionary entry with the composite shape and be able to include it in different pages. Ideally, I would also like to be able to resolve a specific composite shape from a data bound property.
根据我的阅读,WPF方法是使VisualBrush
或DrawingBrush
由形状组成,但是Windows 8中没有这样的类(而且似乎甚至不可能从中派生) Brush
).
From what I've read, the WPF approach was to have a VisualBrush
or DrawingBrush
consisting of the shapes, but there are no such classes in Windows 8 (and it seems like it's not even possible to derive from Brush
).
我应该如何使用WinRT UI做到这一点?
How am I supposed to do this using WinRT UI?
推荐答案
否,您不能在WinRT XAML中将DrawingBrush用作背景属性的值.太糟糕了吧?似乎具有非常强大的功能,可以使用矢量布局设置对象的填充.实际上,DrawingBrush甚至都不是Windows 8的一部分.就是这样.目前,图像是一个很好的解决方案.但是我们感到您的痛苦.
No, you cannot use a DrawingBrush as the value of a background property in WinRT XAML. It's too bad, huh? Seems like a very powerful features to setup the fill of an object with vector layouts. In fact DrawingBrush is not even part of Windows 8 yet. It is what it is. For now, images are a fine solution. But we feel your pain.
我最好还是把VisualBrush也不是WinRT-XAML的一部分.
I might as well toss in that VisualBrush is not part of WinRT-XAML either.
这篇关于我可以将复合形状作为WinRT XAML中的资源吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!