Files
Shrlalgo.RvKits/AntdWpf/Helpers/ProgressAssist.cs
ShrlAlgo 4d35cadb56 更新
2025-07-11 09:20:23 +08:00

34 lines
1.1 KiB
C#

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 AntdWpf.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);
}
}
}