Hi,
2 things.
1) Make sure your enum has the [Flags] attribute.
2) CheckComboBox.SelectedValue is a string of all the selectedItems separated by comma. Ex :
"Test2,Test3,Test4"
The EnumConverter.ConvertTo() method will convert "Test2 | Test3 | Test4" to
"Test2, Test3, Test4"
(note the spaces after the comma, which CheckComboBox.SelectedValue don't like).
You can use the ValueConverter in your CheckComboBoxEditor to remove those spaces :
2 things.
1) Make sure your enum has the [Flags] attribute.
2) CheckComboBox.SelectedValue is a string of all the selectedItems separated by comma. Ex :
"Test2,Test3,Test4"
The EnumConverter.ConvertTo() method will convert "Test2 | Test3 | Test4" to
"Test2, Test3, Test4"
(note the spaces after the comma, which CheckComboBox.SelectedValue don't like).
You can use the ValueConverter in your CheckComboBoxEditor to remove those spaces :
protected override IValueConverter CreateValueConverter()
{
return new MyConverter();
}
where MyConverter is : public class MyConverter : IValueConverter
{
public object Convert( object value, Type targetType, object parameter, CultureInfo culture )
{
if( value == null )
return null;
var stringEnumValues = TypeDescriptor.GetConverter( value ).ConvertTo( value, typeof( string ) ) as string;
return stringEnumValues.Replace( " ", string.Empty );
}
public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture )
{
if( value == null )
return null;
return TypeDescriptor.GetConverter( value ).ConvertFrom( value ) as string;
}
}