ColorBox usage

Oct 1, 2014 at 1:01 AM
Edited Oct 1, 2014 at 1:06 AM
I've been evaluating the ColorBox for use as a WPF "color picker" control, since no such native WPF control exists. Pretty cool control, but I did encounter a few quirks and was wondering if anyone had a fix/workaround?
  1. When opened the ColorBox appears "collapsed", only a colored rectangle is visible. When the rectangle is clicked the ColorBox "expands", showing additional controls. I was wondering if there's a way to get it to open in the "expanded" state, where everything is visible all at once?
  2. Setting the Brush property occasionally throws an ArgumentException: "The provided DependencyObject is not a context for this Freezable". Freezing the brush solves this problem, but I can't just freeze every brush because then some become uneditable. Specifically, when attempting to set the Brush property to a SolidColorBrush, the exception is thrown but freezing the brush before setting the property solves the problem. For GradientBrushes, the exception is not thrown but freezing it causes it to be read-only, throwing a different exception.
    My fix has been to assign the Brush property in a try block and, if an exception is thrown, freezing it and trying again. I was wondering if there is a better way to do this or if I'm just missing something?
  3. I created a "dialog box" in the same style as described in the Documentation section: Window->Grid->ColorBox. When I try to close the Window, the ColorBox collapse' back to its initial state (see item #1, above), but the Window doesn't close. Clicking the Window's close box a second time finally closes it. Is there a way to close the Window without having to try twice? This is kind of counter-intuitive to Windows property editors - having to close them `twice'.
Oct 4, 2014 at 5:20 AM
Thank you for feedback and bug report.

Regarding #1 and #3, I too thought of that when creating the control. But somehow I ended up with open it as popup.
So I am thinking of changing it to show it as whole and leave the View/Hide functionality for the users to implement according to their requirements.

Regarding #2, it would be helpful if you can provide me exact steps to reproduce the issue at my end. I will also try to find it and will fix it

Thank You