ShowUI is a PowerShell module to help build graphical user interfaces in script.
PowerShell C#
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
CSharp First draft at charting Apr 8, 2015
CodeGenerator Rename Set-Property to Set-WpfProperty Mar 17, 2016
CommonControls Rename Set-Property to Set-WpfProperty Mar 17, 2016
Documentation/images Add documentation images Mar 17, 2016
Examples Rename Set-Property to Set-WpfProperty Mar 17, 2016
StyleSystem Rename Set-Property to Set-WpfProperty Mar 17, 2016
TestCases Some examples and test cases I want to keep around Apr 8, 2015
WPF Rename Set-Property to Set-WpfProperty Mar 17, 2016
en-us Man, what a mess that evil branch is. Sep 23, 2011
.gitignore Rename Set-Property to Set-WpfProperty Mar 17, 2016
ConvertTo-ISEAddOn.ps1 Merge changes from James (again) Mar 22, 2013
Export-Application.ps1 Merging and converting to ascii Jul 7, 2011
Get-PowerShellCommand.ps1 Merging and converting to ascii Jul 7, 2011
Get-PowerShellDataSource.ps1 1.5 features -- fix for working with the designer. Oct 24, 2013
Get-PowerShellOutput.ps1 Merging and converting to ascii Jul 7, 2011
Get-ReferencedCommand.ps1 1.5 features -- fix for working with the designer. Oct 24, 2013
Get-UICommand.ps1 Fix the core basics for Get-Input Apr 16, 2015
Get-UIValue.ps1 Switch to ShowUIValue to allow script properties May 17, 2015
Invoke-Background.ps1 1.5 features -- fix for working with the designer. Oct 24, 2013
LICENSE Add github-style documentation of license/readme Apr 9, 2015
New-UIWidget.ps1 Man, what a mess that evil branch is. Sep 23, 2011
README.md Fix documentation image links Mar 17, 2016
Register-PowerShellCommand.ps1 1.5 features -- fix for working with the designer. Oct 24, 2013
Set-UIValue.ps1 Switch to ShowUIValue to allow script properties May 17, 2015
ShowUI.Formats.ps1xml Merging and converting to ascii Jul 7, 2011
ShowUI.VersionHistory.txt 1.5 features -- fix for working with the designer. Oct 24, 2013
ShowUI.psd1 Bump module version May 15, 2015
ShowUI.psm1 Rename Set-Property to Set-WpfProperty Mar 17, 2016
Start-PowerShellCommand.ps1 1.5 features -- fix for working with the designer. Oct 24, 2013
Start-WPFJob.ps1 Remove extra test for ShowUI.WPFJob type. Sep 5, 2013
Stop-PowerShellCommand.ps1 1.5 features -- fix for working with the designer. Oct 24, 2013
Unregister-PowerShellCommand.ps1 1.5 features -- fix for working with the designer. Oct 24, 2013
Update-ControlOutput.ps1 Merging and converting to ascii Jul 7, 2011
Update-WPFJob.ps1 Initialize-EventHandler.ps1 now takes it's parameters as parameters, … Aug 4, 2011
Write-Program.ps1 Merging and converting to ascii Jul 7, 2011
Write-UIOutput.ps1 Some examples and test cases I want to keep around Apr 8, 2015

README.md

ShowUI is the PowerShell module for building user interfaces in script. It's the merger of two previous projects: PowerBoots (by Joel Bennett @Jaykul) and WPK (by James Brundage @StartAutomating), bringing the best of both these projects together to make it easier than ever to create flexible user interfaces directly from PowerShell.

ShowUI is primarily focused on building WPF user interfaces that behave as part of the PowerShell ecosystem: using data binding to expose the data on the objects that come out of PowerShell, and generating output objects into the PowerShell pipeline.

Your first ShowUI program

New-Button -Content "Hello World" -Show

This example is actually more verbose than it needs to be, because the -Content parameter in ShowUI commands is always positional, so the first non-named argument you pass will be used for that. The same is true for the -Children parameter of panels, and in fact, each of the other similar parameters that WPF uses to contain additional controls: Items, Blocks, and Inlines.

Additionally, each control command has an alias available without the New- verb, so you could just call Button instead of New-Button ... and of course, since our button doesn't do anything, we could just as easily have used a Label, and written:

Label "Hello World" -Show

Note: "Label" is also the name of an executable for labelling drives in Windows, make sure ShowUI is imported before you run that command!

A much more practical example

Of course, labels and buttons (and images, charts and tables) are all well and good, but if you're trying to create a user interface in PowerShell the chances are that you're probably trying to make it easier for non-PowerShell users to run a script which requires data entry. Try our Get-Input command, and notice that we can create controls in "CustomControls" with a [OutputType()] specified, and they'll be picked up when you require them by specifying a type in the Get-Input hashtable.

$User = [ordered]@{
   FirstName = "John"
   LastName = "Doe"
   BirthDate = [DateTime]
   UserName = "JDoe"
}

Get-Input $User -Show