New-UDTreeView - Pass the Active Node to a Variable

Hello, all!

I’m struggling with a treeview and then passing the active node to a variable, so I can use it on a toast or continue with my idea of coding using this variable.

New-UDPage -Name “bla” -Icon folder -Content {
New-UDLayout -Columns 2 {
New-UDCard -content {
New-UDTreeView -ToggleColor ‘red’ -ActiveBackgroundColor ‘green’ -Node (
New-UDTreeNode -Name “MY VCENTER” -Children {
foreach ($dc in $cache:dc_vcenter){
New-UDTreeNode -Name $ -Children {
foreach ($cl in (get-view -Server $cache:vcenter_session -ViewType ComputeResource -searchroot $ {
New-UDTreeNode -Id ‘node’ -Name $
New-UDButton -id ‘node’ -Text ‘go!’ -OnClick{
Show-UDToast -Message ???
} #end of New-UDLayout
} #enf of New-UDPage

The tree looks ok, but my toast always says that it’s empty.

screen_2021-01-26 17_26_38

Thanks in advance!
Evertno Cozzi

Hello, same problem here.

I had to create the nodes dynamicly with OnNodeClicked Event of the TreeView component.