Skip to content

BlurredBackground.WPF is a WPF library that allows implementing a frosted glass effect in their applications. By adding a blur effect to the background of UI elements without interfering with the content.

License

Notifications You must be signed in to change notification settings

V4SS3UR/BlurredBackground.WPF

Repository files navigation

BlurredBackground.WPF

BlurredBackground is a powerful library for C# WPF applications that allows developers to easily add a blurred background effect to UI elements in their WPF applications without affecting the element's content. Enhance your application’s visual appeal by creating a frosted glass effect on the backgrounds of specified controls.

Features

  • Blur Background: Easily enable a blur effect on any WPF Border.
  • Customizable Blur Radius: Set the intensity of the blur effect through the BlurRadius property.
  • Dynamic Merging: Control the opacity of the blurred effect with the Merging property.
  • DPI Awareness: Adjusts the blur effect based on the DPI property.

Getting Started

Prerequisites

  • .NET Framework or .NET Core with WPF support.
  • Visual Studio or any compatible IDE for WPF development.

Installation

Install the BlurredBackground.WPF NuGet package :

Install-Package BlurredBackground.WPF

Usage

1. Add a Blurred Background to Your XAML

Include the BlurredBackground effect on a Border in your main window or the appropriate user control.

<Window x:Class="YourNamespace.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:BlurBackground.WPF"
        Title="Blurred Background Example" Height="350" Width="525">
    <Grid>
        <Border local:BlurredBackground.EnableBlur="True"
                local:BlurredBackground.BlurRadius="10"
                local:BlurredBackground.Merging="0.5"
                local:BlurredBackground.Dpi="96"
                Background="Gray">
            <TextBlock Text="Hello, World!" 
                       HorizontalAlignment="Center" 
                       VerticalAlignment="Center" 
                       FontSize="32" 
                       Foreground="White"/>
        </Border>
    </Grid>
</Window>

2. Configure Properties

  • EnableBlur: Set to true to activate the blur effect.
  • BlurRadius: Adjusts the strength of the blur. The default value is 20.0.
  • Merging: Sets the opacity of the blurred background. The default is 1.
  • Dpi: Adjusts the DPI settings for the rendered blur effect. Default is 96 A suitable value for performance is 30.

The library hooks into the Loaded and SizeChanged events of the Border control to apply and update the blur effect dynamically as needed.

Customization

You can customize the blur appearance by adjusting the BlurRadius, Merging, and Dpi properties on the Border control.

Contributing

Contributions are welcome! Please submit pull requests or open issues to discuss potential improvements.


Enhance your application's visual appeal with BlurredBackground!

About

BlurredBackground.WPF is a WPF library that allows implementing a frosted glass effect in their applications. By adding a blur effect to the background of UI elements without interfering with the content.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages