I wish fadeIn() fadeOut() in Silverlight was as easy as jquery made it!
I have a grid with 2 controls in it..one chart and another a textblock. At a time only one of them is visible.
I wish to have a smooth transition on both of these controls开发者_高级运维 whenever their visibility changes.
Whats the simplest way to achieve this?
There's a fade in fade out example on msdn
SL animations may not be as easy as jquery but they are much richer.
For my game, I just set the opacity to increment on a short timer :) (www.aaronahearne.co.uk) if you would like to see an example using CompositionTarget.Rendering
Maybe thats not the ideal solution, but thats how we were taught at university to animate in Silverlight
The best way to achieve this is to use Blend. Open your user control and add two states to the control using the states tab. Name your two states and then setup each state to have the desired visibility and then set the default transition. You can turn on transition preview and switch between the states to see what it looks like.
To have your UI switch between the states add a DataStateBehavior or use a GotToStateAction to swtich them.
精彩评论