SelectedContentTemplateSelector Property

TabControl.SelectedContentTemplateSelector Property


Gets the DataTemplateSelector of the currently selected item.

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

public DataTemplateSelector SelectedContentTemplateSelector { get; internal set; }

Property Value

Type: System.Windows.Controls.DataTemplateSelector

The DataTemplateSelector of the currently selected item. The default is null.

The TabControl updates this property to reference to the DataTemplateSelector for the active TabItem when the tab selection changes. Set TabControl.ContentTemplateSelector or the ContentTemplateSelector property on a TabItem to specify the DataTemplateSelector for a TabItem.

The ControlTemplate of the TabControl uses the ContentPresenter.ContentSource property to bind the ContentPresenter.ContentTemplateSelector property to this property. If you create a new ControlTemplate for the TabControl, be sure to the bind the ContentPresenter.Content property to this property by setting ContentPresenter.ContentSource property to "SelectedContent" or by using the TemplateBinding Markup Extension.

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

Identifier field


Metadata properties set to true


The following example creates a ControlTemplate for the TabControl. Setting the ContentSource property to "SelectedContent" creates aliases to the SelectedContent, SelectedContentTemplate, and SelectedContentTemplateSelector properties.

The following example binds the SelectedContentTemplateSelector property to the ContentPresenter.ContentTemplateSelector property by using the TemplateBinding Markup Extension.

.NET Framework
Available since 3.0
Return to top
© 2015 Microsoft