New-UDTreeView -OnNodeClicked


I’m just adding a treeview and table to display directories and files from an FTP server. The directory tree and file listing is all ok; I just can’t work out how the -OnNodeClicked works. I want to get the ‘Name’ of the node that has been clicked so I can refresh the list of files shown in the table to show the files that are in that particular directory.

New-UDTreeView -Node {
	New-UDTreeNode -Id 'Root' -Name $rootDir -Children {
		$session:directoryObj | where {$_.Parent -eq $rootDir} | ForEach-Object {
			Add-ChildTreeNode $_.Child
} -OnNodeClicked {


I’m using v3. The docs show $eventdata is available after the click but I don’t see any data in that variable. Any tips?

Cheers, Steve.

I’m having the same problem with new-UDTreeView. I get the same error whenever I add -OnNodeClicked.

I’ve recently updated to 1.4.2 from 1.3.2. It was not working on both version.

This is likely a bug. I’ve filed an issue in our backlog to take a look.

1 Like