GridViewColumn.CellTemplateSelector Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets a DataTemplateSelector that determines the template to use to display cells in a column.
public:
property System::Windows::Controls::DataTemplateSelector ^ CellTemplateSelector { System::Windows::Controls::DataTemplateSelector ^ get(); void set(System::Windows::Controls::DataTemplateSelector ^ value); };
public System.Windows.Controls.DataTemplateSelector CellTemplateSelector { get; set; }
member this.CellTemplateSelector : System.Windows.Controls.DataTemplateSelector with get, set
Public Property CellTemplateSelector As DataTemplateSelector
Property Value
A DataTemplateSelector that provides DataTemplate selection for column cells. The default is null
.
Examples
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>
Remarks
The following properties all bind to and display the content of a column cell, and are listed here in their order of precedence, from highest to lowest:
XAML Attribute Usage
<object CellTemplateSelector="{ResourceExtension DataTemplateSelectorClassKey}"/>
XAML Property Element Usage
<object>
<object.CellTemplateSelector>
<MyDataTemplateSelectorImplementation .../>
</object.CellTemplateSelector>
</object>
XAML Values
MyDataTemplateSelectorImplementation
A class derived from DataTemplateSelector that implements a practical SelectTemplate override. For information about how to map your custom class, see XAML Namespaces and Namespace Mapping for WPF XAML.
ResourceExtension
One of the following: StaticResource
, or DynamicResource
. See XAML Resources.
DataTemplateSelectorClassKey
The key that identifies the selector implementation being requested. The key refers to a derived class that implements a practical SelectTemplate override. For information about how to map your custom class, see XAML Namespaces and Namespace Mapping for WPF XAML. You can also programmatically add an instance of your DataTemplateSelector class as a resource to a resource dictionary.
Dependency Property Information
Identifier field | CellTemplateSelectorProperty |
Metadata properties set to true |
None |
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기