2
Vote

ColorPicker - Selected Colour property 2-way binding problem

description

I have used the color picker from the SilverlightContrib.Controls namespace with no modifications other than the fix to the bug in the ColorSpace.cs (reported and fixed on this site) where a value is divided by zero.
 
I am binding the SelectedColor property to a property on my ViewModel to pick the background colour of a series of buttons. The control is correctly giving me the colour i choose when binding from the view to the ViewModel. I have set up two way binding so i can pass a colour back to the control so that the SelectedColor property of the Colour Picker can be set from the ViewModel in order to pass the starting value through depending on which button's background is being set.
 
For instance say i have 2 buttons, one i have set to red and the other to green, when i want to change the green one to be blue then i would expect the marker on the colour picker to start with the value of the green button that i can then move to a blue. If i have used the picker to choose the colour for the red button however the marker/selector will start there instead!
 
I have checked my code to make sure i am setting the property on my ViewModel correctly and it is updated, if i read the SelectedColor property off the picker it shows the same value of the ViewModel property, but the visual state doesn't seem to reflect this.
 
I am using a converter to take the color and translate it to a hex string for storing.
 
Could someone comment on this?

file attachments

comments

serbrech wrote Mar 16, 2011 at 12:05 PM

I posted a fix in another issue, I didn't see your ticket before.
http://silverlightcontrib.codeplex.com/workitem/30319

wrote Feb 14, 2013 at 4:03 AM