Decorating Your PowerShell WPF Script
Let's get back to exploring what we can do with Windows Presentation Foundation (WPF) PowerShell scripts. You've seen how to create a simple form using a StackPanel
. I also demonstrated the flexibility of the Grid
layout. I showed you how to add common controls like text boxes and buttons. However, you may want to add a little eye-candy to your forms. In this article, I'll show you how to add images to your forms, use progress bars, and more. I'll have a download link at the end so you can grab all of my demo code. Let's get started.
Progress Bars
Progress bars are a common control used in many applications. They provide feedback to the user about the status of a task. You can use them to show the progress of a file download, a script execution, or any other task that takes time to complete. Or you can use them as a simple graphing element.
Once you've loaded the required WPF assemblies into your PowerShell session, you can use the Get-TypeMember
command to explore the available properties and methods of the ProgressBar
control.