7 Answers, 1 is accepted
Please check out the "CollectionEditors" article for a reference.
Regards,
Maya
Telerik
CollectionEditor works well for lists of objects with many properties, including one that can be used as a selector.
For simple lists of values or strings, it seems like there is no good solution.
I attached a sample illustrating a case with RadPropertyGrid displaying an item with List<string> property. As you can see, CollectionEditor is its editor. Does this scenario correspond to yours or am I missing anything ?
Regards,
Maya
Telerik
Hello Maya,
Yes, your solution works. Please don't take it personally but this is a bad one.You have to click the drop-down button to see the strings, you get a giant panel, two non functional buttons (because readonly) and a right panel that's mostly useless... Here is below what I ended up with: Bind the read-only strings to a custom editor template with just a listbox.
<
telerik:PropertyDefinition.EditorTemplate
>
<
DataTemplate
>
<
ListBox
ItemsSource
=
"{Binding Path=Strings}"
/>
</
DataTemplate
>
</
telerik:PropertyDefinition.EditorTemplate
>​
Displaying a CollectionEditor for collection properties is the default scenario and its functionality (displaying anything in the field/having enabled/disabled buttons) depends entirely on the type of the source collection.
Still, it is great that found the most appropriate solution for your scenario. Let us know in case you need further assistance with Telerik controls.
Regards,
Maya
Telerik
Hi Maya,
I too have similar requirement but I have to store this information back in my property how can I achieve it.how to get the selected item from ListBox and store it in property.
Regards,
Nagasree
If you are using the approach with the ListBox in the EditorTemplate, you can bind ListBox's SelectedItem to some your property.
Regards,
Yoan
Telerik by Progress