Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Selector.SelectedValue Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets or sets the value of the SelectedItem, obtained by using SelectedValuePath.

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

public object SelectedValue { get; set; }

Property Value

Type: System.Object

The value of the selected item.

The SelectedValuePath property specifies the path to the property that is used to determine the value of the SelectedValue property. Setting SelectedValue to a value X attempts to select an item whose value evaluates to X; if no such item can be found, the selection is cleared.

Identifier field


Metadata properties set to true

BindsTwoWayByDefault, Journal

The following example binds a ListBox to a collection of Employee objects. The example sets SelectedValuePath to @EmployeeNumber and SelectedValue to 12345. This selects the Employee that has 12345 as the value of EmployeeNumber. This example also binds a TextBlock to the SelectedValue of the ListBox. When the user changes the selection in the ListBox, the TextBlock is updated to show the employee number of the currently selected employee.

.NET Framework
Available since 3.0
Available since 4.0
Windows Phone Silverlight
Available since 7.1
Return to top
© 2018 Microsoft