ContentControl.ContentTemplateSelector Property
.NET Framework 3.0
Gets or sets a template selector that enables an application writer to provide custom template-selection logic. This is a dependency property.
Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
/** @property */ public DataTemplateSelector get_ContentTemplateSelector () /** @property */ public void set_ContentTemplateSelector (DataTemplateSelector value)
public function get ContentTemplateSelector () : DataTemplateSelector public function set ContentTemplateSelector (value : DataTemplateSelector)
<object> <object.ContentTemplateSelector> <DataTemplateSelector .../> </object.ContentTemplateSelector> </object>
<object ContentTemplateSelector="{resourceExtension templateSelectorKey}"/>
resourceExtension A markup extension that identifies how to reference the template resource, either StaticResource or DynamicResource. See Resources Overview. templateSelectorKey The key that identifies the requested template selector. The key refers to an existing resource in a ResourceDictionary.
Property Value
A data template selector. The default value is a null reference (Nothing in Visual Basic).If both the ContentTemplateSelector and the ContentTemplate properties are set, then this property is ignored.
The following example shows how the ContentTemplateSelector property is used to select the template to use with a ComboBox control.
<ContentPresenter Name="ContentSite" IsHitTestVisible="False" Content="{TemplateBinding SelectionBoxItem}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" Margin="3,3,23,3" VerticalAlignment="Center" HorizontalAlignment="Left" />
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.Community Additions
ADD
Show: