This project is read-only.


Change Control Contents from PowerShell


I would like to have a ShowUI window with various elements on it, e.g text boxes, stack panels etc. The problem I have with the Update-WPFJob now is that I do not know how to get to the elements that I have described.

So for example if I create a simple label and change the $window.Content that I can change it quite easily, but I do not know how to target individual labels or textboxes for example when I have a Uniform Grid or similar.

How can I accomplish this? I thought that I would be able to use the following:

$job = New-StackPanel -ControlName 'Get-PersonalInformation' -Columns 1 -Children {
New-Label "What is your first name?"            
New-TextBox -Name Firstname
New-Label "What is your last name?"            
New-TextBox -Name Lastname            
New-Label "When were you born?"            
Select-Date -Name Birthdate                    
} -asjob

And then I would be able to update it with something like:

$job | Update-WPFJob { $firstname.Content = "Russell" }

However this does not work and I get an error. I know how I can change the window contents using $window.Content, but that isn't good enough.
Closed Apr 26, 2013 at 5:56 AM by Jaykul