Daqi Pei
Daqi Pei

Reputation: 369

VisualBrush no longer works for Windows 8 Metro Apps?

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.

Upvotes: 1

Views: 1790

Answers (1)

Emond
Emond

Reputation: 50692

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.

Upvotes: 3

Related Questions