的VisualBrush不再为Windows 8地铁应用程序的工作原理? [英] VisualBrush no longer works for Windows 8 Metro Apps?

查看:155
本文介绍了的VisualBrush不再为Windows 8地铁应用程序的工作原理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在发展与反射效果的应用程序。我想一个的VisualBrush分配给Rectangle.Fill为:

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>

和VS报告的VisualBrush并不在我的XML命名空间存在。我用手动将其添加到XAML文件:

And VS reports VisualBrush doesn't exist in my xml namespace. I manually added it to the XAML file using:

的xmlns:FX =htt​​p://schemas.microsoft.com/netfx/2007/xaml/$p$psentation

xmlns:fx="http://schemas.microsoft.com/netfx/2007/xaml/presentation"

和添加的引用的DLL也是如此。不过,现在VS说,我不能一个的VisualBrush分配给类刷的属性。

And added the reference DLL as well. However, now VS says that I cannot assign a VisualBrush to a property of class Brush.

这似乎怪​​我,因为我想起了同样的code在Vista上运行良好。有谁知道,如果有什么事,我在这里失踪?

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?

感谢。

推荐答案

地铁的应用程序不具有相同的一组XAML画笔,资源和要素可作为WPF。

Metro apps do not have the same set of XAML brushes, resources and elements available as in WPF.

一个变通本来使用<一个href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.media.imaging.writeablebitmap.aspx"相对=nofollow> WriteableBitmap的,并使用Render方法来绘制元素的位图。不幸的是<一href="http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/65a6870d-1412-4701-ae12-258ed2b45452"相对=nofollow>目前的版本不支持Render方法。

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.

这篇关于的VisualBrush不再为Windows 8地铁应用程序的工作原理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆