GridViewColumn.CellTemplateSelector Property
.NET Framework 3.5
Gets or sets a DataTemplateSelector that determines the template to use to display cells in a column. This is a dependency property.
Assembly: PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
<object> <object.CellTemplateSelector> <MyDataTemplateSelectorImplementation .../> </object.CellTemplateSelector> </object>
<object CellTemplateSelector="{ResourceExtension DataTemplateSelectorClassKey}"/>
XAML Values
Property Value
Type: System.Windows.Controls.DataTemplateSelectorA DataTemplateSelector that provides DataTemplate selection for column cells. The default is null.
The following example shows how to set the CellTemplateSelector property.
<ListView ItemsSource="{Binding Source={StaticResource EmployeeData},
XPath=Employee}">
<ListView.View>
<GridView>
<GridViewColumn Header="First Name"
DisplayMemberBinding="{Binding XPath=FirstName}" />
<GridViewColumn Header="Last Name"
CellTemplate="{StaticResource LastNameCellTemplate}"/>
<GridViewColumn Header="Favorite City"
CellTemplateSelector="{DynamicResource
FavoriteCityTemplateSelector}"/>
</GridView>
</ListView.View>
</ListView>
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.