2
Vote

ColorPicker: converter exception

description

The color picker gets a red border before picking the first color.
Could it be a null reference exception in one of the converters?

file attachments

comments

PerMalmberg wrote Mar 17, 2012 at 1:35 PM

Hello Objo,

I'm not sure if this is related or not, but I'm currently upgrading my project to use the ColorPicker2 and thus needed a DrawingColorToNullableMediaColorConverter (attached).

One thing I noticed is that when the first color is about to be selected, the ColorPicker tries to set the color to null, despite having read current color from the model. I therefore had to handle this in the converter (else-cause in the Convert-method) otherwise the PropertyChanged-notification would end up with the color white being selected.

I doubt this behavior is intended, comments?

PerMalmberg wrote Mar 17, 2012 at 1:45 PM

Sorry, made a typo: I meant the if( col == null ) -condition, not the else-clause

objo wrote Mar 17, 2012 at 6:08 PM

Yes, this behavior is not intended - but I have not figured out the source of this problem (maybe some of the controls inside the ColorPicker2 are 'fighting'?)

I think the converter from System.Drawing.Color (GDI+) to System.Window.Media.Color (WPF) should be in the client application, not in the PropertyTools.Wpf library. Only WPF assemblies should be referenced since this is a WPF library.

objo wrote Apr 10, 2014 at 12:42 PM

Is this solved? I have not noticed it recently.