月更
This commit is contained in:
33
AntDesignWPF/Helpers/ProgressAssist.cs
Normal file
33
AntDesignWPF/Helpers/ProgressAssist.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows;
|
||||
|
||||
namespace AntDesign.WPF.Helpers
|
||||
{
|
||||
public class ProgressAssist
|
||||
{
|
||||
public static double GetSmoothValue(DependencyObject obj)
|
||||
{
|
||||
return (double)obj.GetValue(SmoothValueProperty);
|
||||
}
|
||||
|
||||
public static void SetSmoothValue(DependencyObject obj, double value)
|
||||
{
|
||||
obj.SetValue(SmoothValueProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SmoothValueProperty =
|
||||
DependencyProperty.RegisterAttached("SmoothValue", typeof(double), typeof(ProgressAssist), new PropertyMetadata(0.0, changing));
|
||||
|
||||
private static void changing(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var anim = new DoubleAnimation((double)e.OldValue, (double)e.NewValue, new TimeSpan(0, 0, 0, 0, 300));
|
||||
(d as ProgressBar).BeginAnimation(System.Windows.Controls.Primitives.RangeBase.ValueProperty, anim, HandoffBehavior.Compose);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user