I'm new to C#, WPF, and XAML. I'm trying to change the fill color of an ellipse based on the height of a hand's position.
First off, I don't get how to even change the color.
privatevoid SetEllipseProperties(FrameworkElement ellipse, Joint joint)
var scaledJoint = joint.ScaleTo(640, 480, .5f, .5f);
// change position
ellipse.Fill = someColorFunction(scaledJoint.Position.Y);
but Fill from above gives me this error:
"System.Windows.FrameworkElement' does not contain a definition for 'Fill' and no extension method 'Fill' accepting a first argument of type 'System.Windows.FrameworkElement' could be found (are you missing a using directive or an assembly reference?)"
I thought Fill is a property of the ellipse class that I can just change. Can anyone help me out?
Without wanting to sound too condescending, Google is your friend. A search for "WPF set the colour of an ellipse" returned many results, and the first one there from MSDN demonstrates exactly how to do it halfway down the page.
Apart from that, the premise of your code is right - every time the Skeleton frame event fires, you would call SetEllipseProperties, then all of the updating should work as you expect with what you've posted.
Edited byMattazzerFriday, September 02, 2011 8:51 AM