
Untitled
By: a guest on
May 28th, 2012 | syntax:
None | size: 1.17 KB | hits: 17 | expires: Never
TabControl Animation effect for the content in SilverLight
private void AniTab_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
TabControl tc = sender as TabControl;
Storyboard TurnIt = new Storyboard();
DoubleAnimation ani = new DoubleAnimation() { Duration = new TimeSpan(0, 0, 1) };
TurnIt.Children.Add(ani);
if (null == ani || null == sender) return;
TurnIt.Stop();
if (tc.SelectedContent != null)
{
if (tc.Projection == null)
{
tc.Projection = new PlaneProjection() { CenterOfRotationY = 0.01 };
PlaneProjection projection = tc.Projection as PlaneProjection;
if (projection.RotationX == 0)
{
ani.To = 360;
}
else
{
ani.From = 360;
ani.To = 0;
}
Storyboard.SetTarget(ani, projection);
Storyboard.SetTargetProperty(ani,
new PropertyPath(PlaneProjection.RotationXProperty));
TurnIt.Begin();
}
}