I'm trying to build a WPF gui where i have two radiobutton listboxes. A button loads the radio buttons:
function mybuttonclick {
$List = get-content "list.txt"
foreach ($item in $list) {
$tmpradio = New-Object System.Windows.Controls.RadioButton
$tmpradio.content = "$item"
$tmpradio.groupname = "MyList"
Register-ObjectEvent -InputObject $tmpradio -EventName Checked -Action { write-host "test"}
$MyListbox.AddChild($tmpradio)
}
}
However i'm getting nothing back, is it a scope issue where the object gets deleted after exiting from the function?
Is there a solution to make so i can pick an action or another wheter the groupname is "MyList" or for example "MyOtherList"