How to Animate (fade) a tube fill (SolidColorBrush) in the Flights Demo?

Jul 7, 2014 at 2:08 AM

I've been at it all day, trying everything I can find on the Internet. All I want to do is have the 'flight' tube (flight path) fade over time.

Right now the program is complaining that no mater which Dispatcher.BeginInvoke I use, I can't access the Fill property of the tube from the thread I'm on. I've tried the Flight's thread and the 'parent' thread, but VS doesn't give you much beyond the line number and {"The calling thread cannot access this object because a different thread owns it."} ...

I even try creating a new SolidColorBrush, and then applying that to the tube as tube.Fill, but no joy-the same error...

Is the AnimateOpacity extension made for this kind of thing? I asked earlier about it, as I can't find any docs on it, and just invoking it as it says to fails with no feedback.

Jul 11, 2014 at 7:54 PM
Make sure the material is not frozen and you are calling from the right thread. Animation should work as everywhere else in WPF.