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

How to show List<string> as Combobox values instead of collection editor

3 Answers 803 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Dharmavaram
Top achievements
Rank 1
Dharmavaram asked on 30 Sep 2016, 10:08 AM

Hi ,

   In our project we used to use Winform PropertyGrid and for some Properties we used TypeConverter to show list of values in comboboxes.

  Now as telerik not supporting complete TypeConverter and sending null value in ITypeDescriptionContext,I can't use it in RadPropertyGrid.

So I thought of Binding List<string> properties to the property as combo and store selectedvalue in another Property once user Select a value in PropertyGrid.

But When I try to bind List<string> Property it is showing it as CollectionEditor but I want to show it as Combobox and once user select I want to store in on another Property so that I can use it further.

And I will get the List dynamically ,so I can't change the type to Enum.

I have tried to create Combobox Template and Combobox userControl I am not able to understand how to pass ItemSource to this usercontrol or template.

I can't create ten templates for each Property.I have to reuse the same template. 

So please suggest something that is feasible as early as Possible.

I have attached two image files. I Want Company,employees,Designations,similar to Countries.

I have created Sample Application but not able to attach here.

3 Answers, 1 is accepted

Sort by
0
Dharmavaram
Top achievements
Rank 1
answered on 30 Sep 2016, 12:34 PM

Hi,

 In simple sentence I want to Provide list of values for string type  Property  in PropertyGrid so that user can select one of the value and that value will be assigned to that Property.The List Of Values we provide are dynamically created not like enum type.

 

Regards,

Nagasree.

0
Accepted
Dilyan Traykov
Telerik team
answered on 05 Oct 2016, 08:36 AM
Hello Nagasree,

I'm attaching a sample project where I've created a custom user control in order to achieve the desired behavior. If you wish to bind the ItemsSource collection to a property of your business object rather than a collection in your view model, you can remove the Source of the binding to do so.

Please have a look at the attached project and let me know if it would work for you.

Regards,
Dilyan Traykov
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Dharmavaram
Top achievements
Rank 1
answered on 05 Oct 2016, 09:35 AM

Hi Dilyan,

   I have updated the ItemsSource in fieldloaded event and achieved my requirement similarly as in your sample application. 

Thanks for the sample application and it helps a lot.

Small suggestion from my side I posted the problem in different ways one week back(different posts).If someone would have replied early ,much of my time wouldn't went to lot of research how to achieve this.

I will close all my posts.

Regards,

Nagasree.

Tags
PropertyGrid
Asked by
Dharmavaram
Top achievements
Rank 1
Answers by
Dharmavaram
Top achievements
Rank 1
Dilyan Traykov
Telerik team
Share this question
or