1
Vote

Color Picker

description

On the home page of this project there's a mention of needing a color picker.
 
I cleaned up and am using the one that is in the SDK. http://blogs.msdn.com/wpfsdk/archive/2006/10/26/Uncommon-Dialogs--Font-Chooser-and-Color-Picker-Dialogs.aspx
 
Attached is the cleaned up styles for it that work in an XBAP. Please feel free to use it.
 
There is also a small bug fix in the color chooser class itself:
 
Need to add some checks on the update for the boundries. The selection indicator triggers a move event and generates a random color.
 
   private void updateMarkerPosition(Point p)
 
   {
 
       markerTransform.X = p.X;
 
       markerTransform.Y = p.Y;
 
       p.X = p.X / m_ColorDetail.ActualWidth;
 
       p.Y = p.Y / m_ColorDetail.ActualHeight;
 
// Bounds check to keep from getting random colors when the selection indicator triggers a move event outside of bounds. -- BKL
 
if (p.X < 0)
 
p.X = 0;
 
else if (p.X > 1)
 
p.X = 1;
 
if (p.Y < 0)
 
p.Y = 0;
 
else if (p.Y > 1)
 
p.Y = 1;
 
       m_ColorPosition = p;
 
       determineColor(p);
 
   }

comments