12

I am trying to create a blur effect in WPF, but I want to blur the content located behind the control (such as a Grid), I do not intend to blur the contents of the Grid.

I want to do something like this image.

enter image description here

kennyzx
  • 12,845
  • 6
  • 39
  • 83
migueladanrm
  • 225
  • 1
  • 4
  • 11

3 Answers3

5

If you are looking for something like this:

blur cherries

The answer is to use a BitmapEffect :

<Image Source="http://www.pingminghealth.com/wp-content/uploads/2010/12/cherries.jpg" Stretch="UniformToFill">
    <Image.BitmapEffect>
        <BlurBitmapEffect Radius="20" />
    </Image.BitmapEffect>
</Image>

You can find a tutorial about it on msdn: How to Apply a Blur Effect to a Visual.

aloisdg
  • 22,270
  • 6
  • 85
  • 105
2

Just in case, someone is still looking for a solution in 2018, something like this worked for me: BlurryControls.BlurryUserControl.cs

ConfusedHorse
  • 99
  • 1
  • 8
  • 5
    Please post the relevant parts of the solution here, as this answer might get useless if the linked page changes or vanishes – Nico Haase Jun 19 '18 at 14:59
-2
<Rectangle>  
    <Rectangle.Effect>  
        <BlurEffect Radius="{DynamicResource BlurRadius}"/>  
    </Rectangle.Effect>  
    <Rectangle.Fill>  
        <VisualBrush  
ViewboxUnits="Absolute"  
Viewbox="{Binding RenderTransform.Children[3],  
        Converter={StaticResource TranslateTransformToRectViewboxVisualBrushConverter},  
        RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Grid}},  
        UpdateSourceTrigger=PropertyChanged}"  
        AlignmentX="Left" AlignmentY="Top"  
    Visual="{Binding ElementName=BackgroundContainer}" Stretch="None">  
            <VisualBrush.Transform>  
                <TranslateTransform X="0" />  
            </VisualBrush.Transform>  
        </VisualBrush>  
    </Rectangle.Fill>  
</Rectangle>  
Dhru 'soni
  • 1,024
  • 7
  • 23