DataGridTemplateColumn.CellTemplate Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets the template to use to display the contents of a cell that is not in editing mode.

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

Public Property CellTemplate As DataTemplate

Property Value

Type: System.Windows.DataTemplate

The template to use to display the contents of a cell that is not in editing mode. The registered default is null. For information about what can influence the value, see DependencyProperty.

The cell template defines how the content is displayed in the column cells. For more information about data templates, see Data Templating Overview and Styling and Templating.

To define the template for a cell that is in editing mode, use the CellEditingTemplate.

The following example shows how to create the CellTemplate for displaying a column of dates.

The following illustration shows the output from the previous XAML.

A column using a DataTemplate

.NET Framework
Available since 4.0
Silverlight
Available since 2.0
Return to top
Show: