PropertyDefinitionBase.ContentTemplate Property
Gets or sets the template that defines the presentation of the property content. This is a dependency property.
Namespace: DevExpress.Xpf.PropertyGrid
Assembly: DevExpress.Xpf.PropertyGrid.v18.2.dll
Declaration
Property Value
Type | Description |
---|---|
DataTemplate | A DataTemplate object that defines the presentation of the property content. |
Remarks
Use the ContentTemplate property to specify a custom template that defines the appearance of the property content.
To learn more, see Appearance Customization.
Example
This example demonstrates a custom template that displays multiple properties in a single PropertyGridControl cell.
Both the absolute and relative paths are specified for the cell editor presenter objects.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-edit-multiple-property-values-in-a-single-propertygridcontrol-cell-e5077.
- ViewModel.cs
- MainWindow.xaml.cs
- MainWindow.xaml
- Application.xaml.vb
- Application.xaml
- MainWindow.xaml.vb
- ViewModel.vb
using System;
namespace DXSample {
public class CategoryAttributesViewModel {
public virtual Person Person { get; protected set; }
public CategoryAttributesViewModel() {
Person = new Person {
FirstName = "Anita",
LastName = "Benson",
Address = new Address {
AddressLine1 = "9602 South Main",
AddressLine2 = "Seattle, 77025, USA",
},
Phone = "7138638137",
};
}
}
public class Person {
public string FirstName { get; set; }
public string LastName { get; set; }
public Address Address { get; set; }
public string Phone { get; set; }
}
public class Address {
public string AddressLine1 { get; set; }
public string AddressLine2 { get; set; }
}
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the ContentTemplate 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.