VisualBrush 不再适用于 Windows 8 Metro 应用程序?
我现在正在开发一个具有反射效果的应用程序。我尝试将 VisualBrush 分配给 Rectangle.Fill,如下所示:
<Rectangle.Fill>
<VisualBrush Opacity="0.75" Stretch="None" Visual="{Binding ElementName=ReflectedVisual}">
</VisualBrush>
</Rectangle.Fill>
VS 报告 VisualBrush 在我的 xml 命名空间中不存在。我使用以下命令手动将其添加到 XAML 文件中:
xmlns:fx="http://schemas.microsoft.com/netfx/2007/xaml/presentation"
并添加了参考 DLL。但是,现在 VS 说我无法将 VisualBrush 分配给 Brush 类的属性。
这对我来说似乎很奇怪,因为我记得同样的代码在 Vista 上运行得很好。有谁知道我这里缺少什么吗?
谢谢。
I'm now developing an app with reflect effect. I tried to assign a VisualBrush to Rectangle.Fill as:
<Rectangle.Fill>
<VisualBrush Opacity="0.75" Stretch="None" Visual="{Binding ElementName=ReflectedVisual}">
</VisualBrush>
</Rectangle.Fill>
And VS reports VisualBrush doesn't exist in my xml namespace. I manually added it to the XAML file using:
xmlns:fx="http://schemas.microsoft.com/netfx/2007/xaml/presentation"
And added the reference DLL as well. However, now VS says that I cannot assign a VisualBrush to a property of class Brush.
This seemed weird to me, as I recalled the same code worked well on Vista. Does anyone know if there's anything I'm missing here?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Metro 应用程序不具有与 WPF 中相同的 XAML 画笔、资源和元素集。
解决方法是使用 WriteableBitmap 并使用 Render 方法将元素绘制到位图上。不幸的是当前版本不支持渲染方法。
Metro apps do not have the same set of XAML brushes, resources and elements available as in WPF.
A work-around would have been to use a WriteableBitmap and use the Render method to draw the element to the bitmap. Unfortunately the current version does not support the Render method.