1
Vote

Incomplete initialization

description

I just experienced an issue where the star control was not being drawn correctly. I set the star foreground to orange. When the value was set to 2 (number of stars 5) ... the control was showing all 5 stars filled.

The problem is that the default value for Star.Value is 0. And by default the background is filled. When the control is setup it correctly sets Star.Value to 0, however the Star.OnValueChanged method is never called because the value didn't change.

One solution is to set the default for Star.ValueProperty to -1, which guarantees it will be changed when it is loaded inside of the RatingsControl. Alternatively, it could be a null value and handle that accordingly..

comments