Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

PropertyGridControl - How to use various editor types based on custom attribute values

$
0
0

In this example, we dynamically generate the PropertyGridControl.PropertyDefinitionsSource and PropertyDefinitionBase.PropertyDefinitionsSource collections based on the underlying data source objects. To generate proper definitions, we implemented a custom PropertyDefinitionTemplateSelector and select one of the following templates based on the underlying property:
1. CollectionDefinitionTemplate. We use it if the underlying property is a collection.
2. CustomDefinitionTemplate. This template is applied only if a specific attribute is set (in this example, we use a custom CustomEditorAttribute).
3. If the underlying object does not meet the previous conditions, we return DefinitionTemplate.

Finally, there is a custom CellTemplateSelector in CustomDefinitionTemplate. In this selector, we check the CustomEditorAttribute attribute value and return one of predefined templates based on it.


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>