In this article I am showing some different ProgressBars for WPF GUI, This progressbar can show your chunk of silhouette image loading instead progress nicely. Below is the demo for my new progressbars, It can be used as an animated text or image. Images should be silhouette, A silhouette is the image of a person, animal, object or scene represented as a solid shape of a single color, usually black, with its edges matching the outline of the subject. The interior of a silhouette is featureless, and the whole is typically presented on a light background, usually white, or none at all.
As start, I need image first and created my own text silhouette image using Microsoft PowerPoint.
In the PowerPoint Add a Text Box from shapes.
Change Text color to black, do not keep any margin for text in the box, it should be as tight as possible, Choose your favorite font and size.
Box background fill should be none
Select outline of textbox to none
Type your text
Right click text box and from context menu choose Save as Picture. Save it as png extension This is critical step, (Need only Png, as this file formats can retain background transparency).
View and Verify your file in photo viewer, It looks good to me, using above method I created few more images.
I have created xaml gui form using Visual Studio, Added ProgressBar, TextBlock and Button controls to it, There is little change I made to the ProgressBar as shown below.
Settings on ProgressBar background (color)is set to null or the color you want, unclosed it in the last, Added ProcessBar.OpacityMask property with ImageSource as earlier created png file and in the last close ProgressBar property.
As to show progressbar correctly on wpf powershell, I am using runspaces in the script. Without runspaces my script will hung and unresponsive, Doesn't show animatation progress and freezes, directly shows 100% progress once all processing done. Here is in below video I used picture as progressbar. When using images make sure you correctly provide complete locations in the script.
Download this complete project here, it is also available on github.com.
Useful Articles Part 1: Create WPF XAML powershell GUI form with Visual studio Part 2: Powershell and WPF: Build GUI applications tutorial Part 3: Create shorter Microsoft Powershell WPF automated clean script Powershell PoshGUI: Convert user to SID and vice versa using Microsoft Powershell GUI: Change Internet Options connections Lan settings proxy server grayed out