Windows apps
Collapse the table of content
Expand the table of content
Information
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.

ComboBox.SelectionBoxItem Property

 

Gets the item that is displayed in the selection box.

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

public object SelectionBoxItem { get; private set; }

Property Value

Type: System.Object

The selected item.

The ControlTemplate of the ComboBox uses this property to show the selected item in the ComboBox. To get the selected item of the ComboBox outside of the ControlTemplate, use the Selector.SelectedItem property instead of this property.

<object property="{TemplateBinding SelectionBoxItem}"/>

Identifier field

SelectionBoxItemProperty

Metadata properties set to true

None

The following example binds the Content property of a ContentPresenter to the SelectionBoxItem property. The ContentPresenter is part of the ControlTemplate for the ComboBox. For the complete sample, see Styling with ControlTemplates Sample.

<ContentPresenter x:Name="ContentSite"
                  IsHitTestVisible="False"
                  Content="{TemplateBinding SelectionBoxItem}"
                  ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
                  ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                  Margin="3,3,23,3"
                  VerticalAlignment="Stretch"
                  HorizontalAlignment="Left">
</ContentPresenter>

.NET Framework
Available since 3.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show:
© 2016 Microsoft