Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 28th, 2012  |  syntax: None  |  size: 1.17 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. TabControl Animation effect for the content in SilverLight
  2. private void AniTab_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
  3.     {
  4.         TabControl tc = sender as TabControl;
  5.         Storyboard TurnIt = new Storyboard();
  6.         DoubleAnimation ani = new DoubleAnimation() { Duration = new TimeSpan(0, 0, 1) };
  7.         TurnIt.Children.Add(ani);
  8.         if (null == ani || null == sender) return;
  9.         TurnIt.Stop();
  10.         if (tc.SelectedContent != null)
  11.         {
  12.             if (tc.Projection == null)
  13.             {
  14.                 tc.Projection = new PlaneProjection() { CenterOfRotationY = 0.01 };
  15.                 PlaneProjection projection = tc.Projection as PlaneProjection;
  16.  
  17.                 if (projection.RotationX == 0)
  18.                 {
  19.                     ani.To = 360;
  20.                 }
  21.                 else
  22.                 {
  23.                     ani.From = 360;
  24.                     ani.To = 0;
  25.                 }
  26.                 Storyboard.SetTarget(ani, projection);
  27.                 Storyboard.SetTargetProperty(ani,
  28.             new PropertyPath(PlaneProjection.RotationXProperty));
  29.  
  30.                 TurnIt.Begin();
  31.             }
  32.         }