Property Editor based on type

3 posts, 0 answers
  1. Jason
    Jason avatar
    10 posts
    Member since:
    Nov 2006

    Posted 08 Aug 2011 Link to this post

    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. Ivan Ivanov
    Ivan Ivanov avatar
    1201 posts

    Posted 09 Aug 2011 Link to this post

    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.

    Ivan Ivanov
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
  3. Adrian
    Adrian avatar
    4 posts
    Member since:
    Mar 2011

    Posted 16 Nov 2011 Link to this post

    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.

Back to Top