This is a migrated thread and some comments may be shown as answers.

Property Editor based on type

2 Answers 72 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 08 Aug 2011, 10:55 PM
How would you create a property editor based on type.  For example:  The sample code creates a property editor for the foreground property that uses the RadColorPicker.  But it is specifying the Foreground property in the data template.

What we would really want is for all color properties to use this particular editor?  We don't want to have to specify the property name.

2 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 09 Aug 2011, 08:08 AM
Hi Jason,

You may try loading the DataTemplates at runtime to achieve this. I have prepared an example project that illustrates this approach. It is attached for your reference.

Regards,
Ivan Ivanov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
0
Adrian
Top achievements
Rank 1
answered on 16 Nov 2011, 01:58 PM
Hi, just to contribute with an idea:
I used the same method from the MVVM RI example of Microsoft Prism, using the prism DataTemplateSelector and some inheritance in viewmodels. That worked perfect and you can have 1 pair view-viewmodel for every type without using code-behind.
This could be a better approach depending on if you are using MVVM or not in your project.

Regards
Adrián 
Tags
PropertyGrid
Asked by
Jason
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Adrian
Top achievements
Rank 1
Share this question
or