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

Custom ComboBox Editor in PropertyGrid

Dec 8, 2011 at 7:03 AM

I am using PropertyGrid of Extended WPF Toolkit. I want my ICollectionView property in my class to be represented as ComboBox in the propertyGrid so I have designed a custom Editor which implements ITypeEditor.

My Code looks something like


       public ICollectionView PanelNamesList






   public class SamplePanelNamesEditor : ITypeEditor


       public System.Windows.FrameworkElement ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.PropertyItem propertyItem)


           ComboBox cmbBox = new ComboBox();

            Binding binding = new Binding("Value");

           binding.Source = propertyItem;

           binding.Mode = BindingMode.TwoWay;

           BindingOperations.SetBinding(cmbBox, ComboBox.ItemsSourceProperty, binding);


           PropertyPath itemPath = new PropertyPath("SelectedItem");

           Binding selItemBinding = new Binding("Value");

           selItemBinding.Source = propertyItem.Instance;

           selItemBinding.Mode = BindingMode.TwoWay;

           BindingOperations.SetBinding(cmbBox, ComboBox.SelectedItemProperty, selItemBinding);

           return cmbBox;



I am able to display the list of Items in the ComboBox in PropertyGrid , but I am not able to set TwoWay binding on SelectedItem of the list. I am using the same ICollectionView as the ItemSource of another ComboBox . I want a way to select an Item from the list so that the SelectedItem on both the ComboBoxes ( PropertyGrid’s ComboBox and other ComboBox’s where the ICollectionView is used as the ItemSource) display the same Item.

Dec 8, 2011 at 7:25 AM

Sorry i missed setting IsSynchronizedWithCurrentItem to True in the Custom Editor. Its working now :)