Beispiel #1
0
 /// <summary>
 /// Begins an animation that automatically sets final value to be held. Used with FillType.Stop rather than default FillType.Hold.
 /// </summary>
 /// <param name="element">Content Element to animate.</param>
 /// <param name="anim">Animation to use on element.</param>
 /// <param name="dp">Property of element to animate using anim.</param>
 /// <param name="To">Final value of element's dp.</param>
 public static void BeginAdjustableAnimation(this ContentElement element, DependencyProperty dp, GridLengthAnimation anim, object To)
 {
     if (dp.IsValidType(To))
     {
         element.SetValue(dp, To);
         element.BeginAnimation(dp, anim);
     }
     else
     {
         throw new Exception("To object value passed is of the wrong Type. Given: " + To.GetType() + "  Expected: " + dp.PropertyType);
     }
 }