ColorBox usage

Oct 1, 2014 at 12:00 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 ColorBoxexpands', 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 and freezing it causes it to be read-only, throwing 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 theDocumentation' section: Window->Grid->ColorBox. When I try to close the Window, the ColorBox collapses' 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 themtwice'.