views:

16

answers:

2

I feel like this is a very simple question, but I can't really find any examples on the internet of anyone who wants to do something like this. What I have right now is a half circle gauge control that I made in WPF. I have a RotateTransform that has data bound to its angle so as the data comes in it shows the angle visually. The problem is some of the values are +90 degrees and the way the gauge looks as well it gets harder to see the needle past about the 80 degree point. Right now I have a storyboard that has 3 frames with the needle "wobbling" between like 70 and 73 degrees.

What I have been trying to figure out is some way to add logic to all of this so that at values of +/- 70 degree values the animation will loop giving the gauge a "bottoming out" look to it. Ive found plenty of info on triggers and whatnot but I can't find any examples of people wanting to add logic to produce animations. I feel like I need some sort of callback or something. At first I was thinking a data converter would be the ideal choice but the more I look into these options I think they won't work.

EDIT: I'm lookin for something like...

if (angle > 70)
    object.BeginAnimation(WobbleRight)
else if (angle < -70)
    object.BeginAnimation(WobbleLeft)
else
    object.Angle = angle

However it would need to check this every time Angle gets updated. Would this just be the job for a callback?

A: 

Here's one already made, to compare the code:

http://dashboarding.codeplex.com/

SteveCav
Thanks, but not quite what I am looking for. I am already to the point of where his controls are but looking to add a little extra. He binds the spline animations to angle which I think is what gives it that nice smooth transition look. My problem is that I have the animation but I want to have something like...if (angle > 70) object.BeginAnimation(WobbleRight)else if (angle < -70) object.BeginAnimation(WobbleLeft)else object.Angle = angleHowever it would need to check this every time Angle gets updated. Would this just be the job for a callback?
Matt M
A: 

Nevermind I figured out how to do it to a degree. Just created a custom dependency property and had a callback for it. From there you can do stuff every time the value updates. This is sorta what I was thinking was needed.

Matt M