diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RunningBlockDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RunningBlockDemoCtl.xaml
index be53f250..70c9afd2 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RunningBlockDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RunningBlockDemoCtl.xaml
@@ -1,38 +1,39 @@
+ xmlns:ex="clr-namespace:HandyControlDemo.Tools.Extension"
+ xmlns:hc="https://handyorg.github.io/handycontrol"
+ Background="{DynamicResource RegionBrush}">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/src/Shared/HandyControl_Shared/Controls/Block/RunningBlock/RunningBlock.cs b/src/Shared/HandyControl_Shared/Controls/Block/RunningBlock/RunningBlock.cs
index c0072681..fb669a74 100644
--- a/src/Shared/HandyControl_Shared/Controls/Block/RunningBlock/RunningBlock.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Block/RunningBlock/RunningBlock.cs
@@ -124,6 +124,15 @@ public class RunningBlock : ContentControl
set => SetValue(AutoReverseProperty, ValueBoxes.BooleanBox(value));
}
+ public static readonly DependencyProperty RunningDirectionProperty = DependencyProperty.Register(
+ nameof(RunningDirection), typeof(RunningDirection), typeof(RunningBlock), new PropertyMetadata(RunningDirection.EndToStart));
+
+ public RunningDirection RunningDirection
+ {
+ get => (RunningDirection) GetValue(RunningDirectionProperty);
+ set => SetValue(RunningDirectionProperty, value);
+ }
+
private void UpdateContent()
{
if (_elementContent == null || _elementPanel == null) return;
@@ -182,11 +191,11 @@ public class RunningBlock : ContentControl
? TimeSpan.FromSeconds(Math.Abs(to - from) / Speed)
: Duration;
- var animation = new DoubleAnimation(from, to, duration)
- {
- RepeatBehavior = RepeatBehavior.Forever,
- AutoReverse = AutoReverse
- };
+ var animation = RunningDirection is RunningDirection.EndToStart
+ ? new DoubleAnimation(to, from, duration)
+ : new DoubleAnimation(from, to, duration);
+ animation.RepeatBehavior = RepeatBehavior.Forever;
+ animation.AutoReverse = AutoReverse;
Storyboard.SetTargetProperty(animation, propertyPath);
Storyboard.SetTarget(animation, _elementContent);
diff --git a/src/Shared/HandyControl_Shared/Data/Enum/RunningDirection.cs b/src/Shared/HandyControl_Shared/Data/Enum/RunningDirection.cs
new file mode 100644
index 00000000..dfbd41c1
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Data/Enum/RunningDirection.cs
@@ -0,0 +1,7 @@
+namespace HandyControl.Data;
+
+public enum RunningDirection
+{
+ EndToStart,
+ StartToEnd
+}
diff --git a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
index 4673bbb0..8fe51b1f 100644
--- a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
+++ b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
@@ -98,6 +98,7 @@
+