This project has moved and is read-only. For the latest updates, please go here.

Display a dynamic collection using ComboBox in PropertyGrid

May 19, 2012 at 2:58 PM
Edited May 23, 2012 at 7:31 AM

Hi,

      I am using the WPF Extended PropertyGrid, In my application, I have a dynamic collection of Items in the Model and i want these items to be displayed in a ComboBox in the PropertyGrid. Any suggestions on how to get this working?

Thanks in advance..

Regards,

Ram

May 23, 2012 at 7:21 AM

Hi All , Any suggestions on this ?

Coordinator
May 28, 2012 at 3:19 PM

Hi,

 

I would suggest you to create a custom editor that derives from ComboBoxEditor.  Your "CustomComboBoxEditor" will have to override the CreateItemsSource method and return a collection of items that will be used by the ComboBox.  Since your model has a dynamic collection of items, I recommend that you return a collection of type ObservableCollection<object>.  If you keep a reference on the ObservableCollection<object>, you'll be able to add or remove items from it anytime.  Since this type of collection implements INotifyCollectionChanged, the ComboBox will be able to update its list automatically.

 

I hope this will help you.