Import-Module WPKYou should see something like the following:
New-Window -Name "WPK" -Title "WPK Snippets" -Width 250 -Height 175 -Show {
New-Grid -Rows 28,100 -Columns 200* {
New-TextBox -Name txtSliderValue -Column 0 -Row 1
$fill = [System.Windows.Media.Brushes]::Blue
$stroke = [System.Windows.Media.Brushes]::Black
New-Ellipse -Name oEllipse -Column 0 -Row 2 -Height 100 -Width 100 `
-Fill $fill -Stroke $stroke
New-Slider -Name Slider -Column 0 -Row 0 -Minimum 0 -Maximum 200 `
-IsSnapToTickEnabled -On_ValueChanged {
$txtSliderValue = $window | Get-ChildControl txtSliderValue
$slider = $window | Get-ChildControl Slider
$oEllipse = $window | Get-ChildControl oEllipse
$oEllipse.width = $slider.value
}
}
}
Moving the slider triggers the -On_ValueChanged event.
Moving it around you should see the width of the ellipse change accordingly.
Download the script.
Enjoy!