New-UDTreeView
Synopsis
Creates a new tree view.
Syntax
New-UDTreeView [[-Id] <String>] [-Node] <ScriptBlock> [[-OnNodeClicked] <Endpoint>] [[-Style] <Hashtable>] [[-ClassName] <String>] [-Expanded] [-PreventCollapse] [<CommonParameters>]Description
Creates a new tree view.
Parameters
-Id
The ID of the component. It defaults to a random GUID.
Required? false
Position? 1
Default value [Guid]::NewGuid()
Accept pipeline input? false
Aliases
Accept wildcard characters? false-Node
A collection of root nodes to show within the tree view.
-OnNodeClicked
A script block that is called when a node is clicked. $EventData will contain the node that was clicked.
-Style
A set of CSS styles to apply to the tree view.
-ClassName
A CSS className to apply to the tree view.
-Expanded
Whether the tree view should be expanded by default.
-PreventCollapse
Prevents the tree view from collapsing when a node is clicked. Assumes -Expanded.
Common parameters
This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters.
Outputs
Examples
Example 1: Tree View
A basic tree view component.
Example 2: OnNodeClicked
A tree view with an OnNodeClicked script block that shows a toast when a node is clicked.
Example 3: Expanded
A tree view that is expanded by default.
Example 4: OnNodeClicked
A tree view with an OnNodeClicked script block that adds a child node when a node is clicked.
Example 5: Icons
A tree view with icons for nodes.
Example 6: PreventCollapse
A tree view that is expanded by default and prevents collapsing when a node is clicked.
Last updated
Was this helpful?