2025-07-11 09:20:23 +08:00
|
|
|
|
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;
|
|
|
|
|
|
|
2025-07-31 20:12:01 +08:00
|
|
|
|
namespace AntDesign.WPF.Helpers
|
2025-07-11 09:20:23 +08:00
|
|
|
|
{
|
|
|
|
|
|
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);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|