Merge pull request #140 from HandyOrg/add-running-text
Add running text
@ -63,6 +63,10 @@ Step 4:enjoy coding
|
||||
|
||||
## Latest examples
|
||||
|
||||
### RunningBlock
|
||||
|
||||
![RunningBlock](https://raw.githubusercontent.com/NaBian/HandyControl/master/Resources/RunningBlock.gif)
|
||||
|
||||
### ImageBlock
|
||||
|
||||
![ImageBlock](https://raw.githubusercontent.com/NaBian/HandyControl/master/Resources/ImageBlock.gif)
|
||||
|
BIN
Resources/RunningBlock.gif
Normal file
After Width: | Height: | Size: 509 KiB |
@ -48,6 +48,36 @@
|
||||
<ProjectReference Include="..\HandyControl_Core_30\HandyControl_Core_30.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\1.gif">
|
||||
<Link>Resources\Img\QQ\1.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\2.gif">
|
||||
<Link>Resources\Img\QQ\2.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\3.gif">
|
||||
<Link>Resources\Img\QQ\3.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\4.gif">
|
||||
<Link>Resources\Img\QQ\4.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\5.gif">
|
||||
<Link>Resources\Img\QQ\5.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\6.gif">
|
||||
<Link>Resources\Img\QQ\6.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\7.gif">
|
||||
<Link>Resources\Img\QQ\7.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\8.gif">
|
||||
<Link>Resources\Img\QQ\8.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\9.gif">
|
||||
<Link>Resources\Img\QQ\9.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\10.gif">
|
||||
<Link>Resources\Img\QQ\10.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\1.jpg">
|
||||
<Link>Resources\Img\1.jpg</Link>
|
||||
</Resource>
|
||||
@ -363,6 +393,9 @@
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\ImageStack_16x.png">
|
||||
<Link>Resources\Img\LeftMainContent\ImageStack_16x.png</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\Dynamic_16x.png">
|
||||
<Link>Resources\Img\LeftMainContent\Dynamic_16x.png</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\Dance.png">
|
||||
<Link>Resources\Img\Dance.png</Link>
|
||||
</Resource>
|
||||
|
@ -83,6 +83,36 @@
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\1.gif">
|
||||
<Link>Resources\Img\QQ\1.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\2.gif">
|
||||
<Link>Resources\Img\QQ\2.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\3.gif">
|
||||
<Link>Resources\Img\QQ\3.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\4.gif">
|
||||
<Link>Resources\Img\QQ\4.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\5.gif">
|
||||
<Link>Resources\Img\QQ\5.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\6.gif">
|
||||
<Link>Resources\Img\QQ\6.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\7.gif">
|
||||
<Link>Resources\Img\QQ\7.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\8.gif">
|
||||
<Link>Resources\Img\QQ\8.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\9.gif">
|
||||
<Link>Resources\Img\QQ\9.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\10.gif">
|
||||
<Link>Resources\Img\QQ\10.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\1.jpg">
|
||||
<Link>Resources\Img\1.jpg</Link>
|
||||
</Resource>
|
||||
@ -387,6 +417,9 @@
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>MessageToken.cs</LastGenOutput>
|
||||
</Content>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\Dynamic_16x.png">
|
||||
<Link>Resources\Img\LeftMainContent\Dynamic_16x.png</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\Dance.png">
|
||||
<Link>Resources\Img\Dance.png</Link>
|
||||
</Resource>
|
||||
|
@ -151,6 +151,36 @@
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\1.gif">
|
||||
<Link>Resources\Img\QQ\1.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\2.gif">
|
||||
<Link>Resources\Img\QQ\2.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\3.gif">
|
||||
<Link>Resources\Img\QQ\3.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\4.gif">
|
||||
<Link>Resources\Img\QQ\4.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\5.gif">
|
||||
<Link>Resources\Img\QQ\5.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\6.gif">
|
||||
<Link>Resources\Img\QQ\6.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\7.gif">
|
||||
<Link>Resources\Img\QQ\7.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\8.gif">
|
||||
<Link>Resources\Img\QQ\8.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\9.gif">
|
||||
<Link>Resources\Img\QQ\9.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\QQ\10.gif">
|
||||
<Link>Resources\Img\QQ\10.gif</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\1.jpg">
|
||||
<Link>Resources\Img\1.jpg</Link>
|
||||
</Resource>
|
||||
@ -436,6 +466,7 @@
|
||||
<Link>Properties\Langs\Lang.resx</Link>
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Lang.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -449,6 +480,9 @@
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>MessageToken.cs</LastGenOutput>
|
||||
</Content>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\Dynamic_16x.png">
|
||||
<Link>Resources\Img\LeftMainContent\Dynamic_16x.png</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\Dance.png">
|
||||
<Link>Resources\Img\Dance.png</Link>
|
||||
</Resource>
|
||||
@ -491,7 +525,6 @@
|
||||
<Link>Resources\fabric-icons.ttf</Link>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="..\..\Shared\HandyControlDemo_Shared\HandyControlDemo_Shared.projitems" Label="Shared" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
@ -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);
|
||||
|
@ -55,7 +55,8 @@ var controlList = new List<string>
|
||||
"ButtonGroupDemoCtl",
|
||||
"CardDemoCtl",
|
||||
"MagnifierDemoCtl",
|
||||
"ImageBlockDemoCtl"
|
||||
"ImageBlockDemoCtl",
|
||||
"RunningBlockDemoCtl"
|
||||
};
|
||||
var styleList = new List<string>
|
||||
{
|
||||
|
@ -159,6 +159,9 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\RateDemoCtl.xaml.cs">
|
||||
<DependentUpon>RateDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\RunningBlockDemoCtl.xaml.cs">
|
||||
<DependentUpon>RunningBlockDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\ScrollViewerDemoCtl.xaml.cs">
|
||||
<DependentUpon>ScrollViewerDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@ -566,6 +569,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\RunningBlockDemoCtl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\ScrollViewerDemoCtl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@ -800,4 +807,9 @@
|
||||
<ItemGroup>
|
||||
<Folder Include="$(MSBuildThisFileDirectory)Service\Data\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="E:\Work\GitHub\HandyControl\src\Shared\HandyControlDemo_Shared\UserControl\Controls\RunningTextDemoCtl.xaml.cs">
|
||||
<DependentUpon>RunningBlockDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1239,6 +1239,15 @@ namespace HandyControlDemo.Properties.Langs {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 滚动块 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string RunningBlock {
|
||||
get {
|
||||
return ResourceManager.GetString("RunningBlock", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 滚动视图 的本地化字符串。
|
||||
/// </summary>
|
||||
|
@ -633,4 +633,7 @@
|
||||
<data name="ImageBlock" xml:space="preserve">
|
||||
<value>ImageBlock</value>
|
||||
</data>
|
||||
<data name="RunningBlock" xml:space="preserve">
|
||||
<value>RunningBlock</value>
|
||||
</data>
|
||||
</root>
|
@ -633,4 +633,7 @@
|
||||
<data name="ImageBlock" xml:space="preserve">
|
||||
<value>图片块</value>
|
||||
</data>
|
||||
<data name="RunningBlock" xml:space="preserve">
|
||||
<value>滚动块</value>
|
||||
</data>
|
||||
</root>
|
After Width: | Height: | Size: 221 B |
BIN
src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/1.gif
Normal file
After Width: | Height: | Size: 6.2 KiB |
BIN
src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/10.gif
Normal file
After Width: | Height: | Size: 9.3 KiB |
BIN
src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/2.gif
Normal file
After Width: | Height: | Size: 7.7 KiB |
BIN
src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/3.gif
Normal file
After Width: | Height: | Size: 5.7 KiB |
BIN
src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/4.gif
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/5.gif
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/6.gif
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/7.gif
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/8.gif
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
src/Shared/HandyControlDemo_Shared/Resources/Img/QQ/9.gif
Normal file
After Width: | Height: | Size: 6.1 KiB |
@ -0,0 +1,27 @@
|
||||
<UserControl x:Class="HandyControlDemo.UserControl.RunningBlockDemoCtl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
Background="{DynamicResource RegionBrush}"
|
||||
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs">
|
||||
<hc:TransitioningContentControl>
|
||||
<StackPanel Margin="32" VerticalAlignment="Center">
|
||||
<hc:RunningBlock Content="{Binding Source={x:Static langs:Lang.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=5}"/>
|
||||
<hc:RunningBlock Content="{Binding Source={x:Static langs:Lang.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=10}" FontSize="20" FontWeight="Bold" Foreground="OrangeRed" Duration="0:0:10" Margin="0,16,0,0"/>
|
||||
<hc:RunningBlock Margin="0,16,0,0" Duration="0:0:20" IsRunning="{Binding IsMouseOver,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2BooleanReConverter}}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<hc:GifImage Uri="/HandyControlDemo;component/Resources/Img/QQ/1.gif" Margin="10,0"/>
|
||||
<hc:GifImage Uri="/HandyControlDemo;component/Resources/Img/QQ/2.gif" Margin="10,0"/>
|
||||
<hc:GifImage Uri="/HandyControlDemo;component/Resources/Img/QQ/3.gif" Margin="10,0"/>
|
||||
<hc:GifImage Uri="/HandyControlDemo;component/Resources/Img/QQ/4.gif" Margin="10,0"/>
|
||||
<hc:GifImage Uri="/HandyControlDemo;component/Resources/Img/QQ/5.gif" Margin="10,0"/>
|
||||
<hc:GifImage Uri="/HandyControlDemo;component/Resources/Img/QQ/6.gif" Margin="10,0"/>
|
||||
<hc:GifImage Uri="/HandyControlDemo;component/Resources/Img/QQ/7.gif" Margin="10,0"/>
|
||||
<hc:GifImage Uri="/HandyControlDemo;component/Resources/Img/QQ/8.gif" Margin="10,0"/>
|
||||
<hc:GifImage Uri="/HandyControlDemo;component/Resources/Img/QQ/9.gif" Margin="10,0"/>
|
||||
<hc:GifImage Uri="/HandyControlDemo;component/Resources/Img/QQ/10.gif" Margin="10,0"/>
|
||||
</StackPanel>
|
||||
</hc:RunningBlock>
|
||||
</StackPanel>
|
||||
</hc:TransitioningContentControl>
|
||||
</UserControl>
|
@ -0,0 +1,10 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
{
|
||||
public partial class RunningBlockDemoCtl
|
||||
{
|
||||
public RunningBlockDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -325,6 +325,11 @@
|
||||
<Image Source="../../Resources/Img/LeftMainContent/TextBlock_16x.png"/>
|
||||
</hc:EdgeElement.LeftContent>
|
||||
</ListBoxItem>
|
||||
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.RunningBlockDemoCtl}" Content="{x:Static langs:Lang.RunningBlock}">
|
||||
<hc:EdgeElement.LeftContent>
|
||||
<Image Source="../../Resources/Img/LeftMainContent/Dynamic_16x.png"/>
|
||||
</hc:EdgeElement.LeftContent>
|
||||
</ListBoxItem>
|
||||
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.CardDemoCtl}" Content="{x:Static langs:Lang.Card}">
|
||||
<hc:EdgeElement.LeftContent>
|
||||
<Image Source="../../Resources/Img/LeftMainContent/VSO_Card_16x.png"/>
|
||||
@ -400,7 +405,7 @@
|
||||
<Image Source="../../Resources/Img/LeftMainContent/HoverMenu_16x.png"/>
|
||||
</hc:EdgeElement.LeftContent>
|
||||
</ListBoxItem>
|
||||
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.RangeSliderDemoCtl}" Content="{x:Static langs:Lang.RangeSlider}">
|
||||
<ListBoxItem Tag="{x:Static data:MessageToken.RangeSliderDemoCtl}" Content="{x:Static langs:Lang.RangeSlider}">
|
||||
<hc:EdgeElement.LeftContent>
|
||||
<Image Source="../../Resources/Img/LeftMainContent/brackets_Square_16xLG.png"/>
|
||||
</hc:EdgeElement.LeftContent>
|
||||
|
@ -83,6 +83,8 @@ namespace HandyControl.Controls
|
||||
StartAnimate();
|
||||
}
|
||||
};
|
||||
|
||||
Unloaded += (s, e) => Dispose();
|
||||
}
|
||||
|
||||
public GifImage(string filename)
|
||||
|
@ -0,0 +1,90 @@
|
||||
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(FrameworkElement))]
|
||||
[TemplatePart(Name = ElementPanel, Type = typeof(Panel))]
|
||||
public class RunningBlock : ContentControl
|
||||
{
|
||||
private const string ElementContent = "PART_ContentElement";
|
||||
|
||||
private const string ElementPanel = "PART_Panel";
|
||||
|
||||
protected Storyboard _storyboard;
|
||||
|
||||
private FrameworkElement _elementContent;
|
||||
|
||||
private FrameworkElement _elementPanel;
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
base.OnApplyTemplate();
|
||||
|
||||
_elementContent = GetTemplateChild(ElementContent) as FrameworkElement;
|
||||
_elementPanel = GetTemplateChild(ElementPanel) as Panel;
|
||||
}
|
||||
|
||||
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 || _elementPanel == null) return;
|
||||
|
||||
_storyboard?.Stop();
|
||||
_storyboard = new Storyboard();
|
||||
|
||||
_elementPanel.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
|
||||
_elementPanel.Width = _elementPanel.DesiredSize.Width;
|
||||
_elementPanel.Height = _elementPanel.DesiredSize.Height;
|
||||
|
||||
var animation = new DoubleAnimation(-_elementContent.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();
|
||||
}
|
||||
}
|
||||
}
|
@ -28,6 +28,7 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\RangeTrack.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\RangeThumb.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\TwoWayRangeBase.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\RunningBlock.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\OpenLinkCommand.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\BorderCircularClipConverter.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\Number2PercentageConverter.cs" />
|
||||
@ -372,6 +373,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Base\RunningBlockBaseStyle.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Base\SliderBaseStyle.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@ -728,6 +733,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\RunningBlock.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\ScrollViewer.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
@ -0,0 +1,34 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="BaseStyle.xaml"/>
|
||||
<ResourceDictionary Source="../../Basic/Sizes.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style x:Key="RunningBlockBaseStyle" BasedOn="{StaticResource BaseStyle}" TargetType="controls:RunningBlock">
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Padding" Value="0,10"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:RunningBlock">
|
||||
<Border CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" Padding="{TemplateBinding Padding}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" ClipToBounds="True">
|
||||
<controls:SimplePanel HorizontalAlignment="Left" x:Name="PART_Panel">
|
||||
<ContentPresenter x:Name="PART_ContentElement" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left">
|
||||
<ContentPresenter.RenderTransform>
|
||||
<TransformGroup>
|
||||
<TranslateTransform X="0"/>
|
||||
</TransformGroup>
|
||||
</ContentPresenter.RenderTransform>
|
||||
</ContentPresenter>
|
||||
</controls:SimplePanel>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
@ -0,0 +1,10 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Base/RunningBlockBaseStyle.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style BasedOn="{StaticResource RunningBlockBaseStyle}" TargetType="controls:RunningBlock"/>
|
||||
|
||||
</ResourceDictionary>
|
@ -70,6 +70,7 @@
|
||||
<ResourceDictionary Source="Rectangle.xaml"/>
|
||||
<ResourceDictionary Source="Magnifier.xaml"/>
|
||||
<ResourceDictionary Source="ToggleBlock.xaml"/>
|
||||
<ResourceDictionary Source="RunningBlock.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
</ResourceDictionary>
|