Hi,
In your ResolveValueBinding method, you bind to Editor.SelectedValue AND Editor.SelectedItem. The 2nd one cause an overflow exception, so I removed it.
To make your sample work, you need to call Editor.EndInit() when the initialization is done to update the CheckComboBox.SelectedValue. This is usually called by default, but here, the CheckComboBox is not used in a DataTemplate. So you can call it. Here's your modified ResolveValueBinding :
In your ResolveValueBinding method, you bind to Editor.SelectedValue AND Editor.SelectedItem. The 2nd one cause an overflow exception, so I removed it.
To make your sample work, you need to call Editor.EndInit() when the initialization is done to update the CheckComboBox.SelectedValue. This is usually called by default, but here, the CheckComboBox is not used in a DataTemplate. So you can call it. Here's your modified ResolveValueBinding :
protected override void ResolveValueBinding( PropertyItem propertyItem )
{
var _binding = new Binding( "Value" );
_binding.Source = propertyItem;
_binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
_binding.Mode = BindingMode.TwoWay;
_binding.Converter = CreateValueConverter();
BindingOperations.SetBinding( Editor, CheckComboBox.SelectedValueProperty, _binding ); // or BindingOperations.SetBinding( Editor, ValueProperty, _binding );
//var _binding2 = new Binding( "Value" );
//_binding2.Source = propertyItem;
//_binding2.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
//_binding2.Mode = BindingMode.TwoWay;
//_binding2.Converter = CreateValueConverter();
//BindingOperations.SetBinding( Editor, CheckComboBox.SelectedItemProperty, _binding2 );
Editor.ItemsSource = Enum.GetValues( propertyItem.Value.GetType() );
Editor.Initialized += Editor_Initialized;
}
private void Editor_Initialized( object sender, EventArgs e )
{
Editor.EndInit();
}