VisualBrush 不再适用于 Windows 8 Metro 应用程序?

发布于 2024-12-29 14:26:35 字数 574 浏览 4 评论 0原文

我现在正在开发一个具有反射效果的应用程序。我尝试将 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

離殇 2025-01-05 14:26:35

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文