VisualBrush no longer works for Windows 8 Metro Apps?

夙愿已清 提交于 2019-12-11 08:02:37

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/9044066/visualbrush-no-longer-works-for-windows-8-metro-apps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!