wpf-devexpress-dot-xpf-dot-propertygrid-dot-propertydefinition-6ef1760c.md
Gets or sets the template that defines the presentation of data cells. This is a dependency property.
Namespace : DevExpress.Xpf.PropertyGrid
Assembly : DevExpress.Xpf.PropertyGrid.v25.2.dll
NuGet Package : DevExpress.Wpf.PropertyGrid
public DataTemplate CellTemplate { get; set; }
Public Property CellTemplate As DataTemplate
| Type | Description |
|---|---|
| DataTemplate |
A DataTemplate object that defines the presentation of data cells.
|
When using CellTemplate note the following:
The following example demonstrates how to use the CellTemplate property to specify the required editor for a property grid cell.
<Window ...
xmlns:dxprg="http://schemas.devexpress.com/winfx/2008/xaml/propertygrid"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" >
<Window.DataContext>
<local:ViewModel/>
</Window.DataContext>
<Grid>
<dxprg:PropertyGridControl SelectedObject="{Binding}" ShowCategories="False" ShowMenuButtonInRows="False" ShowProperties="WithPropertyDefinitions" >
<dxprg:PropertyDefinition Path="Name"/>
<dxprg:PropertyDefinition Path="Notes">
<dxprg:PropertyDefinition.CellTemplate>
<DataTemplate>
<dxe:MemoEdit Name="PART_Editor" MemoTextWrapping="Wrap" PopupWidth="200"/>
</DataTemplate>
</dxprg:PropertyDefinition.CellTemplate>
</dxprg:PropertyDefinition>
</dxprg:PropertyGridControl>
</Grid>
</Window>
public class ViewModel {
public string Name { get; set; }
public string Notes { get; set; }
public ViewModel() {
Name = "Andrew Fuller";
Notes = "Andrew received his BTS commercial in 1974 and a Ph.D.
in international marketing from the University of Dallas in 1981.";
}
}
To learn more, see Appearance Customization.
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CellTemplate property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
wpf-property-grid-apply-data-annotation-attributes/CS/MainWindow.xaml#L16
<dxprg:PropertyDefinition Path="Photo" AllowExpanding="Never">
<dxprg:PropertyDefinition.CellTemplate>
<DataTemplate>
See Also