diff --git a/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj b/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj index 760f6243..b5293883 100644 --- a/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj +++ b/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj @@ -48,6 +48,36 @@ + + Resources\Img\QQ\1.gif + + + Resources\Img\QQ\2.gif + + + Resources\Img\QQ\3.gif + + + Resources\Img\QQ\4.gif + + + Resources\Img\QQ\5.gif + + + Resources\Img\QQ\6.gif + + + Resources\Img\QQ\7.gif + + + Resources\Img\QQ\8.gif + + + Resources\Img\QQ\9.gif + + + Resources\Img\QQ\10.gif + Resources\Img\1.jpg @@ -363,6 +393,9 @@ Resources\Img\LeftMainContent\ImageStack_16x.png + + Resources\Img\LeftMainContent\Dynamic_16x.png + Resources\Img\Dance.png diff --git a/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj b/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj index 46d7b027..0b10fbd3 100644 --- a/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj +++ b/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj @@ -83,6 +83,36 @@ + + Resources\Img\QQ\1.gif + + + Resources\Img\QQ\2.gif + + + Resources\Img\QQ\3.gif + + + Resources\Img\QQ\4.gif + + + Resources\Img\QQ\5.gif + + + Resources\Img\QQ\6.gif + + + Resources\Img\QQ\7.gif + + + Resources\Img\QQ\8.gif + + + Resources\Img\QQ\9.gif + + + Resources\Img\QQ\10.gif + Resources\Img\1.jpg @@ -387,6 +417,9 @@ TextTemplatingFileGenerator MessageToken.cs + + Resources\Img\LeftMainContent\Dynamic_16x.png + Resources\Img\Dance.png diff --git a/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj b/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj index 00990efe..251e2bd5 100644 --- a/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj +++ b/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj @@ -151,6 +151,36 @@ + + Resources\Img\QQ\1.gif + + + Resources\Img\QQ\2.gif + + + Resources\Img\QQ\3.gif + + + Resources\Img\QQ\4.gif + + + Resources\Img\QQ\5.gif + + + Resources\Img\QQ\6.gif + + + Resources\Img\QQ\7.gif + + + Resources\Img\QQ\8.gif + + + Resources\Img\QQ\9.gif + + + Resources\Img\QQ\10.gif + Resources\Img\1.jpg @@ -436,6 +466,7 @@ Properties\Langs\Lang.resx PublicResXFileCodeGenerator Lang.Designer.cs + Designer @@ -449,6 +480,9 @@ TextTemplatingFileGenerator MessageToken.cs + + Resources\Img\LeftMainContent\Dynamic_16x.png + Resources\Img\Dance.png @@ -491,7 +525,6 @@ Resources\fabric-icons.ttf - \ No newline at end of file diff --git a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs index 2c3e791a..ff297a66 100644 --- a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs +++ b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs @@ -106,6 +106,8 @@ public static readonly string ImageBlockDemoCtl = nameof(ImageBlockDemoCtl); + public static readonly string RunningBlockDemoCtl = nameof(RunningBlockDemoCtl); + public static readonly string ButtonDemoCtl = nameof(ButtonDemoCtl); public static readonly string RepeatButtonDemoCtl = nameof(RepeatButtonDemoCtl); diff --git a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt index c5d3944e..20805e83 100644 --- a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt +++ b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt @@ -55,7 +55,8 @@ var controlList = new List "ButtonGroupDemoCtl", "CardDemoCtl", "MagnifierDemoCtl", - "ImageBlockDemoCtl" + "ImageBlockDemoCtl", + "RunningBlockDemoCtl" }; var styleList = new List { diff --git a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems index 8d202da6..5594995f 100644 --- a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems +++ b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems @@ -159,6 +159,9 @@ RateDemoCtl.xaml + + RunningBlockDemoCtl.xaml + ScrollViewerDemoCtl.xaml @@ -566,6 +569,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -800,4 +807,9 @@ + + + RunningBlockDemoCtl.xaml + + \ No newline at end of file diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs index ce60584b..c5abda38 100644 --- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs +++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs @@ -1239,6 +1239,15 @@ namespace HandyControlDemo.Properties.Langs { } } + /// + /// 查找类似 滚动块 的本地化字符串。 + /// + public static string RunningBlock { + get { + return ResourceManager.GetString("RunningBlock", resourceCulture); + } + } + /// /// 查找类似 滚动视图 的本地化字符串。 /// diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx index 824b75e4..8156f572 100644 --- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx +++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx @@ -633,4 +633,7 @@ ImageBlock + + RunningBlock + \ No newline at end of file diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx index 2cc4d56b..6515453f 100644 --- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx +++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx @@ -633,4 +633,7 @@ 图片块 + + 滚动块 + \ No newline at end of file diff --git a/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/Dynamic_16x.png b/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/Dynamic_16x.png new file mode 100644 index 00000000..dfcd0380 Binary files /dev/null and b/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/Dynamic_16x.png differ diff --git a/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/1.gif b/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/1.gif new file mode 100644 index 00000000..05f39cf6 Binary files /dev/null and b/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/1.gif differ diff --git a/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/10.gif b/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/10.gif new file mode 100644 index 00000000..56427e20 Binary files /dev/null and b/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/10.gif differ diff --git a/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/2.gif b/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/2.gif new file mode 100644 index 00000000..fed13970 Binary files /dev/null and b/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/2.gif differ diff --git a/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/3.gif b/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/3.gif new file mode 100644 index 00000000..74567e8e Binary files /dev/null and b/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/3.gif differ diff --git a/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/4.gif b/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/4.gif new file mode 100644 index 00000000..8fe5a4f5 Binary files /dev/null and b/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/4.gif differ diff --git a/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/5.gif b/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/5.gif new file mode 100644 index 00000000..05b2d290 Binary files /dev/null and b/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/5.gif differ diff --git a/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/6.gif b/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/6.gif new file mode 100644 index 00000000..e602647c Binary files /dev/null and b/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/6.gif differ diff --git a/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/7.gif b/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/7.gif new file mode 100644 index 00000000..18025fc0 Binary files /dev/null and b/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/7.gif differ diff --git a/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/8.gif b/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/8.gif new file mode 100644 index 00000000..f3dc4dab Binary files /dev/null and b/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/8.gif differ diff --git a/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/9.gif b/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/9.gif new file mode 100644 index 00000000..452d39ac Binary files /dev/null and b/src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/9.gif differ diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RunningBlockDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RunningBlockDemoCtl.xaml new file mode 100644 index 00000000..ae97d2a2 --- /dev/null +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RunningBlockDemoCtl.xaml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RunningBlockDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RunningBlockDemoCtl.xaml.cs new file mode 100644 index 00000000..a115d149 --- /dev/null +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/RunningBlockDemoCtl.xaml.cs @@ -0,0 +1,10 @@ +namespace HandyControlDemo.UserControl +{ + public partial class RunningBlockDemoCtl + { + public RunningBlockDemoCtl() + { + InitializeComponent(); + } + } +} diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml index 2d8d68d4..68a0e2a9 100644 --- a/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml @@ -325,6 +325,11 @@ + + + + + @@ -400,7 +405,7 @@ - + diff --git a/src/Shared/HandyControl_Shared/Controls/Other/RunningBlock.cs b/src/Shared/HandyControl_Shared/Controls/Other/RunningBlock.cs new file mode 100644 index 00000000..b02dd021 --- /dev/null +++ b/src/Shared/HandyControl_Shared/Controls/Other/RunningBlock.cs @@ -0,0 +1,87 @@ +using System; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media; +using System.Windows.Media.Animation; +using HandyControl.Data; + +namespace HandyControl.Controls +{ + [TemplatePart(Name = ElementContent, Type = typeof(UIElement))] + public class RunningBlock : ContentControl + { + private const string ElementContent = "PART_ContentElement"; + + protected Storyboard _storyboard; + + private UIElement _elementContent; + public override void OnApplyTemplate() + { + base.OnApplyTemplate(); + + _elementContent = GetTemplateChild(ElementContent) as UIElement; + } + + public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register( + "Orientation", typeof(Orientation), typeof(RunningBlock), new FrameworkPropertyMetadata(default(Orientation), FrameworkPropertyMetadataOptions.AffectsRender)); + + public Orientation Orientation + { + get => (Orientation) GetValue(OrientationProperty); + set => SetValue(OrientationProperty, value); + } + + public static readonly DependencyProperty DurationProperty = DependencyProperty.Register( + "Duration", typeof(Duration), typeof(RunningBlock), new FrameworkPropertyMetadata(new Duration(TimeSpan.FromSeconds(5)), FrameworkPropertyMetadataOptions.AffectsRender)); + + public Duration Duration + { + get => (Duration) GetValue(DurationProperty); + set => SetValue(DurationProperty, value); + } + + public static readonly DependencyProperty IsRunningProperty = DependencyProperty.Register( + "IsRunning", typeof(bool), typeof(RunningBlock), new PropertyMetadata(ValueBoxes.TrueBox, (o, args) => + { + var ctl = (RunningBlock)o; + var v = (bool)args.NewValue; + if (v) + { + ctl._storyboard?.Resume(); + } + else + { + ctl._storyboard?.Pause(); + } + })); + + public bool IsRunning + { + get => (bool) GetValue(IsRunningProperty); + set => SetValue(IsRunningProperty, value); + } + + private void UpdateContent() + { + if (_elementContent == null) return; + + _storyboard = new Storyboard(); + + var animation = new DoubleAnimation(-ActualWidth, ActualWidth, Duration) + { + RepeatBehavior = RepeatBehavior.Forever + }; + Storyboard.SetTarget(animation, _elementContent); + Storyboard.SetTargetProperty(animation, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)")); + _storyboard.Children.Add(animation); + + _storyboard.Begin(); + } + + protected override void OnRender(DrawingContext drawingContext) + { + base.OnRender(drawingContext); + UpdateContent(); + } + } +} \ No newline at end of file diff --git a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems index af6f3a4c..c83ace32 100644 --- a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems +++ b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems @@ -28,6 +28,7 @@ + @@ -372,6 +373,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -728,6 +733,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/RunningBlockBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/RunningBlockBaseStyle.xaml new file mode 100644 index 00000000..88a1a704 --- /dev/null +++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/RunningBlockBaseStyle.xaml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/RunningBlock.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/RunningBlock.xaml new file mode 100644 index 00000000..68f2a7b7 --- /dev/null +++ b/src/Shared/HandyControl_Shared/Themes/Styles/RunningBlock.xaml @@ -0,0 +1,10 @@ + + + + + + +