> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/powershell-universal/de/powershell-befehle/new-udtreeview.md).

# New-UDTreeView

New-UDTreeView erstellt in PowerShell Universal eine hierarchische Struktur aus erweiterbaren New-UDTreeNode-Elementen zum Durchsuchen verschachtelter Datenstrukturen.

### Übersicht

Erstellt eine neue Baumansicht.

### Syntax

```powershell
New-UDTreeView [[-Id] <String>] [-Node] <ScriptBlock> [[-OnNodeClicked] <Endpoint>] [[-Style] <Hashtable>] [[-ClassName] <String>] [-Expanded] [-PreventCollapse] [<CommonParameters>]
```

### Beschreibung

Erstellt eine neue Baumansicht.

### Parameter

#### -Id

Die ID der Komponente. Standardmäßig ist es eine zufällige GUID.

```
Required?                    false
Position?                    1
Default value                [Guid]::NewGuid()
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Node

Eine Sammlung von Stammknoten, die in der Baumansicht angezeigt werden sollen.

```
Required?                    true
Position?                    2
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -OnNodeClicked

Ein Skriptblock, der aufgerufen wird, wenn auf einen Knoten geklickt wird. $EventData enthält den Knoten, auf den geklickt wurde.

```
Required?                    false
Position?                    3
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Style

Ein Satz von CSS-Stilen, die auf die Baumansicht angewendet werden sollen.

```
Required?                    false
Position?                    4
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -ClassName

Ein CSS-className, der auf die Baumansicht angewendet werden soll.

```
Required?                    false
Position?                    5
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Expanded

Ob die Baumansicht standardmäßig erweitert werden soll.

```
Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -PreventCollapse

Verhindert, dass die Baumansicht zusammengeklappt wird, wenn auf einen Knoten geklickt wird. Setzt -Expanded voraus.

```
Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### Allgemeine Parameter

Dieses Cmdlet unterstützt die allgemeinen Parameter: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable und OutVariable. Weitere Informationen finden Sie unter [about\_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).

### Ausgaben

### Beispiele

#### Beispiel 1: Baumansicht

```powershell
New-UDTreeView -Node {
    New-UDTreeNode -Name "Root Node" -Id "root1" -Children {
        New-UDTreeNode -Name "Child Node" -Id "child1" -Children {
            New-UDTreeNode -Name "Grandchild Node" -Id "grandchild1" -Leaf
        }
        New-UDTreeNode -Name "Child Node 2" -Id "child2" -Children {
            New-UDTreeNode -Name "Grandchild Node 2" -Id "grandchild2" -Leaf
        }
    }
} -Id "treeview1"
```

Eine einfache Baumansichts-Komponente.

#### Beispiel 2: OnNodeClicked

```powershell
New-UDTreeView -Node {
    New-UDTreeNode -Name "Root Node" -Id "root2" -Children {
        New-UDTreeNode -Name "Child Node" -Id "child3" -Children {
            New-UDTreeNode -Name "Grandchild Node" -Id "grandchild3" -Leaf
        }
        New-UDTreeNode -Name "Child Node 2" -Id "child4" -Children {
            New-UDTreeNode -Name "Grandchild Node 2" -Id "grandchild4"
        }
    }
} -Id "treeview2" -OnNodeClicked {
    Show-UDToast -Message "You clicked $($EventData.Id)"
}
```

Eine Baumansicht mit einem OnNodeClicked-Skriptblock, der beim Klicken auf einen Knoten einen Toast anzeigt.

#### Beispiel 3: Expanded

```powershell
New-UDTreeView -Node {
    New-UDTreeNode -Name "Root Node" -Id "root3" -Children {
        New-UDTreeNode -Name "Child Node" -Id "child5" -Children {
            New-UDTreeNode -Name "Grandchild Node" -Id "grandchild5"  -Leaf
        }
        New-UDTreeNode -Name "Child Node 2" -Id "child6" -Children {
            New-UDTreeNode -Name "Grandchild Node 2" -Id "grandchild6"  -Leaf
        }
    }
} -Id "treeview3" -Expanded
```

Eine Baumansicht, die standardmäßig erweitert ist.

#### Beispiel 4: OnNodeClicked

```powershell
New-UDTreeView -Node {
    New-UDTreeNode -Name "Root Node" -Id "root4"
} -Id "treeview4" -OnNodeClicked {
    New-UDTreeNode -Name "Child Node"
}
```

Eine Baumansicht mit einem OnNodeClicked-Skriptblock, der beim Klicken auf einen Knoten einen untergeordneten Knoten hinzufügt.

#### Beispiel 5: Symbole

```powershell
New-UDTreeView -Node {
    New-UDTreeNode -Name "Root Node" -Id "root5" -Children {
        New-UDTreeNode -Name "Child Node" -Id "child7" -Children {
            New-UDTreeNode -Name "Grandchild Node" -Id "grandchild7" -Leaf -Icon (New-UDIcon -Icon "File")
        } -Icon (New-UDIcon -Icon "Folder") -ExpandedIcon (New-UDIcon -Icon "FolderOpen")
        New-UDTreeNode -Name "Child Node 2" -Id "child8" -Children {
            New-UDTreeNode -Name "Grandchild Node 2" -Id "grandchild8" -Leaf -Icon (New-UDIcon -Icon "File")
        } -Icon (New-UDIcon -Icon "Folder") -ExpandedIcon (New-UDIcon -Icon "FolderOpen")
    }
} -Id "treeview5" -Expanded
```

Eine Baumansicht mit Symbolen für Knoten.

#### Beispiel 6: PreventCollapse

```powershell
New-UDTreeView -Node {
    New-UDTreeNode -Name "Root Node" -Id "root6" -Children {
        New-UDTreeNode -Name "Child Node" -Id "child9" -Children {
            New-UDTreeNode -Name "Grandchild Node" -Id "grandchild9"  -Leaf
        }
        New-UDTreeNode -Name "Child Node 2" -Id "child10" -Children {
            New-UDTreeNode -Name "Grandchild Node 2" -Id "grandchild10"  -Leaf
        }
    }
} -Id "treeview3" -Expanded -PreventCollapse
```

Eine Baumansicht, die standardmäßig erweitert ist und das Zusammenklappen verhindert, wenn auf einen Knoten geklickt wird.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.devolutions.net/powershell-universal/de/powershell-befehle/new-udtreeview.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
