PowerShell & WPF: Display alert bar in your application

In this post I will show you a cool library that allows you to display cool alert bar notification in your application. I will explain how to use it with PowerShell.

Where to find it ?
This library is called AlertBarWPF
It has been created by Chad Kuehn.
See the GitHub project here
See the website, here

How to install it ?
Download Nuget.exe, here
Run the below command in the same folder that the nuget.exe

Get the assembly
Once you have install package with nuget you have to find the assembly we will use.
This one is called AlertBarWpf.dll
Copy it in your WPF folder project.
You can also find the dll in the GitHub project release here

Get the example
My example is available on GitHub, using the below link:

How to use it ?
To use it we will proceed as below:
1. Load the library in the PS1 using the below command:
2. In your XAML, add the below line in the Window part
3. Add the below line where you want to display the alert
5. Display the notification as below:

You can display the alert bar where you want.
In my case I added it in the first line of my grid, meaning it will be displayed at the top.
You can also display it as a status bar, at the bottom or in group of control using a StackPanel.

Alert type
There are 4 notification type available:
- Information
- Success
- Warning
- Danger

To use one of them proceed as below:
See below an overview of each notification:

Customize it
Add a countdown
You can choose to close automatically the alert after a specific time or display it until user closes it.
In the below example an information alert will be displayed until the user closes it:
See below the result:

In the below example, the informtion alert will be closed after 3 seconds:
See below the result:

Display or hide alert icon
By default an icon is displayed in the alert, see below:
You can hide it using the IconVisibility property.
In the below example I will hide it from the PS1.
See below the result:

WPF_Libraries 1625259372699769242

Publier un commentaire

Accueil item


Mes articles en français

Author of Books

PowerShell GUI & WPF Group

PowerShell GUI & WPF Group

Join the FPSUGR

Join the FPSUGR