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

4 posts, 1 answers
  1. Dharmavaram
    Dharmavaram avatar
    72 posts
    Member since:
    Jun 2013

    Posted 30 Sep Link to this post

    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.

  2. Dharmavaram
    Dharmavaram avatar
    72 posts
    Member since:
    Jun 2013

    Posted 30 Sep in reply to Dharmavaram Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Answer
    Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    368 posts

    Posted 05 Oct Link to this post

    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.
  5. Dharmavaram
    Dharmavaram avatar
    72 posts
    Member since:
    Jun 2013

    Posted 05 Oct in reply to Dilyan Traykov Link to this post

    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.

Back to Top