Sdílet prostřednictvím


TreeView.SelectedItem Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the selected item in a TreeView.

Namespace:  System.Windows.Controls
Assembly:  System.Windows.Controls (in System.Windows.Controls.dll)

Syntax

'Declaration
Public Property SelectedItem As Object
public Object SelectedItem { get; private set; }

Property Value

Type: System.Object
The currently selected item or nulla null reference (Nothing in Visual Basic) if no item is selected. The default value is nulla null reference (Nothing in Visual Basic).

Remarks

Dependency property identifier field: SelectedItemProperty

When the value of SelectedItem changes, the SelectedItemChanged event occurs.

SelectedItem is a read-only property. To set the selected item for a TreeView, set the IsSelected property of a TreeViewItem.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.