Powershell WPF GUI modification
I have been playing around with Powershell and the .net framework Windows Presentation Foundation (WPF). Using powershell, i can insert XAML code inside an object and execute this from within Powershell showing a GUI for users to interact with.
This is all working very well, and im having lost of fun playing with this (as shown by posting from home on a bank holiday monday lol), The only problem im having is when i try and edit the design of the form after the form has been generated.
I can change basic elements in the form (Height, Width e.c.t) by changing the desired variable and entering a new value, then passing the processing thread to the WPF generated window with a "regenerate" command. However i can not figure out how i can add extra generated content (i.e. extra text box or checkboxes) with this method, as there doesn't seem to be a method to add children / content to the canvas?
The only way i have found to get around this so far is to have my powershell code include a button on click even that closes the current open form, re-generates the XAML code for the window, and then show the form dialog again. This however only seems to work once, and im not sure how this would effect other options within the program.
Does anyone have a better method to dynamically add / remove UI elements with this?