We provide a mechanism to display and edit properties different from the property specified in the property definition’s Path. This can be done using a custom ContentTemplate.
Assume that you have an Item class with the complex Name property.
[C#]publicclassPerson{//...publicAddressAddress{get;set;}//...}publicclassAddress{publicstringAddressLine1{get;set;}publicstringAddressLine2{get;set;}}
The task is to display and edit the Address.AddressLine1 and Address.AddressLine2 property values in the Address row. This can be done using the template below.
[XAML]<dxprg:PropertyDefinitionPath="Address"><dxprg:PropertyDefinition.ContentTemplate><DataTemplate><StackPanel><dxprg:CellEditorPresenterPath="AddressLine1"/><dxprg:CellEditorPresenterPath="AddressLine2"/></StackPanel></DataTemplate></dxprg:PropertyDefinition.ContentTemplate></dxprg:PropertyDefinition>
CellEditorPresenter.Path works similar to PropertyDefinitionBase.Path - it specifies a path to the data source field that will be displayed within the cell editor. To learn more on how to build paths, refer to the Property Definitions topic.
Note that the Path may work in two modes: Relative and Absolute (to switch between these modes, set the PathMode property). In Relative mode, the specified path is applied to the object originally displayed in the row. In Absolute mode, the path is applied to the entire SelectedObject.
To configure a cell editor generated in CellEditorPresenter, set required properties for the PropertyDefinition object that is mapped to the same property. For example:
[XAML]<dxprg:PropertyDefinitionPath="Address"Header="Contact"IsReadOnly="False"><dxprg:PropertyDefinition.ContentTemplate><DataTemplate><StackPanel><dxprg:CellEditorPresenterPath="Phone"PathMode="Absolute"/></StackPanel></DataTemplate></dxprg:PropertyDefinition.ContentTemplate></dxprg:PropertyDefinition><dxprg:PropertyDefinitionPath="Phone"IsReadOnly="True"Visibility="Collapsed"/>