aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.SharedUI/Animations
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-02-17 22:31:33 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-02-17 22:31:33 +0200
commit95c0b0ccb0a1bc60de533464552fcb0c5e44779f (patch)
treec3876a6b03dcf9bb378112571be40231da87c61c /Software/Visual_Studio/Tango.SharedUI/Animations
parenta6ebe1e48de8ba5e4d936c4825060a08f2695785 (diff)
downloadTango-95c0b0ccb0a1bc60de533464552fcb0c5e44779f.tar.gz
Tango-95c0b0ccb0a1bc60de533464552fcb0c5e44779f.zip
Some more work on FSE..
Diffstat (limited to 'Software/Visual_Studio/Tango.SharedUI/Animations')
-rw-r--r--Software/Visual_Studio/Tango.SharedUI/Animations/GridLengthAnimation.cs71
1 files changed, 71 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.SharedUI/Animations/GridLengthAnimation.cs b/Software/Visual_Studio/Tango.SharedUI/Animations/GridLengthAnimation.cs
new file mode 100644
index 000000000..52dcacedf
--- /dev/null
+++ b/Software/Visual_Studio/Tango.SharedUI/Animations/GridLengthAnimation.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Media.Animation;
+using System.Windows;
+
+namespace Tango.SharedUI.Animations
+{
+ public class GridLengthAnimation : AnimationTimeline
+ {
+ public static readonly DependencyProperty FromProperty;
+ public static readonly DependencyProperty ToProperty;
+
+ static GridLengthAnimation()
+ {
+ FromProperty = DependencyProperty.Register("From", typeof(GridLength), typeof(GridLengthAnimation));
+ ToProperty = DependencyProperty.Register("To", typeof(GridLength), typeof(GridLengthAnimation));
+ }
+
+ protected override Freezable CreateInstanceCore()
+ {
+ return new GridLengthAnimation();
+ }
+
+ public override Type TargetPropertyType
+ {
+ get { return typeof(GridLength); }
+ }
+
+ public GridLength From
+ {
+ get
+ {
+ return (GridLength)GetValue(GridLengthAnimation.FromProperty);
+ }
+ set
+ {
+ SetValue(GridLengthAnimation.FromProperty, value);
+ }
+ }
+
+ public GridLength To
+ {
+ get
+ {
+ return (GridLength)GetValue(GridLengthAnimation.ToProperty);
+ }
+ set
+ {
+ SetValue(GridLengthAnimation.ToProperty, value);
+ }
+ }
+
+ public override object GetCurrentValue(object defaultOriginValue, object defaultDestinationValue, AnimationClock animationClock)
+ {
+
+ double fromValue = ((GridLength)GetValue(GridLengthAnimation.FromProperty)).Value;
+ double toValue = ((GridLength)GetValue(GridLengthAnimation.ToProperty)).Value;
+
+ if (fromValue > toValue)
+ {
+ return new GridLength((1 - animationClock.CurrentProgress.Value) * (fromValue - toValue) + toValue, this.To.IsStar ? GridUnitType.Star : GridUnitType.Pixel);
+ }
+ else
+ {
+ return new GridLength((animationClock.CurrentProgress.Value) * (toValue - fromValue) + fromValue, this.To.IsStar ? GridUnitType.Star : GridUnitType.Pixel);
+ }
+
+ }
+ }
+}