Class does not find when using XamlCompositionBrushBase
So, I tried to use BackdropBrush with XamlCompositionBrushBase by creating a BackdropBlurBrush class, but when I call it from XAML it doesn't find the class. I created a class for the main project. See error here .
Example on GitHub: https://github.com/vitorgrs/HostBackdrop/
+3
source to share
1 answer
Your custom composition brush is not a UIElement
and therefore cannot be placed directly in the visual XAML tree.
Try adding it as a brush for an element -
<Grid>
<Grid.Background>
<local:BackdropBlurBrush BlurAmount="5" />
</Grid.Background>
</Grid>
Usually you want to place your blur brush on top of your background image like this:
<Grid x:Name="Root">
<Grid.Background>
<ImageBrush Stretch="UniformToFill" ImageSource="background.jpg"/>
</Grid.Background>
<Rectangle>
<Rectangle.Fill>
<local:BackdropBlurBrush BlurAmount="5" />
</Rectangle.Fill>
</Rectangle>
</Grid>
+3
source to share