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

Multiple Items - DataTemplateSelector

1 Answer 212 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
FrimaStudio
Top achievements
Rank 1
FrimaStudio asked on 24 Apr 2013, 03:38 AM
Hello,

Today, I added support for multiple selection in our tool. We are using the WPF RadPropertyGrid. 

So we modified the control to use :
SelectionMode="Multiple" and PropertySetMode="Intersection".

I am using the EditorTemplateSelector to select a custom editor for some class types such as "Point".

Before I did this when the PropertyGrid is in single selection mode:

if (item as PropertyDefinition != null && (item as PropertyDefinition).SourceProperty.PropertyType == typeof(System.Windows.Point))
{
return PointPropertyDataTemplate;
}

Now, with multiple selection, the SourceProperty.PropertyType is always of type System.Object. I understand it is now pointing to a dynamic model but it is still be important to keep the original type somewhere else in the parameter. It doesn't make sense to me to add a massive switch case with ALL (over 400) parameters hardcoded "names", and this create software very hard to maintain. I've read that you are working on the Editor Template Attribute that we could set in code but still I want to rely on the class type for single and multiple selection to avoid filling code with redundant attribute.

Do you have any suggestion for this? 

Also, having new converters for every class type when using multiple selection is also making my software filled with dozens of converter classes. Why is multiple selection absolutely require this as the property of every selected object is of the same type.

Thank you

Simon

1 Answer, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 26 Apr 2013, 02:51 PM
Hello,

 Unfortunately, our current implementation of this feature relies exclusively on dynamic properties (there is an implementation of DynamicObject behind) and DLR do not provide any information about the underlying property type. We have a few ideas about improving this behavior in future versions by replacing it with ICustomTypeProvider, but such a feature is not yet officially planned. I will keep you in touch in case there is any progress on this.

Regards,
Ivan Ivanov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
PropertyGrid
Asked by
FrimaStudio
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Share this question
or