mirror of
https://gitee.com/handyorg/HandyControl.git
synced 2024-11-29 18:38:30 +08:00
add loading
This commit is contained in:
parent
b9c99b1f4c
commit
26ddc4f935
135
HandyControl/Controls/Loading/LoadingBase.cs
Normal file
135
HandyControl/Controls/Loading/LoadingBase.cs
Normal file
@ -0,0 +1,135 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
public abstract class LoadingBase : ContentControl
|
||||
{
|
||||
protected Storyboard Storyboard;
|
||||
|
||||
public static readonly DependencyProperty IsRunningProperty = DependencyProperty.Register(
|
||||
"IsRunning", typeof(bool), typeof(LoadingBase), new PropertyMetadata(true, (o, args) =>
|
||||
{
|
||||
var ctl = (LoadingBase) o;
|
||||
var v = (bool) args.NewValue;
|
||||
if (v)
|
||||
{
|
||||
ctl.Storyboard?.Resume();
|
||||
}
|
||||
else
|
||||
{
|
||||
ctl.Storyboard?.Pause();
|
||||
}
|
||||
}));
|
||||
|
||||
public bool IsRunning
|
||||
{
|
||||
get { return (bool) GetValue(IsRunningProperty); }
|
||||
set { SetValue(IsRunningProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty DotCountProperty = DependencyProperty.Register(
|
||||
"DotCount", typeof(int), typeof(LoadingBase),
|
||||
new FrameworkPropertyMetadata(5, FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
||||
public static readonly DependencyProperty DotIntervalProperty = DependencyProperty.Register(
|
||||
"DotInterval", typeof(double), typeof(LoadingBase),
|
||||
new FrameworkPropertyMetadata(10.0, FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
||||
public static readonly DependencyProperty DotBorderBrushProperty = DependencyProperty.Register(
|
||||
"DotBorderBrush", typeof(Brush), typeof(LoadingBase),
|
||||
new FrameworkPropertyMetadata(default(Brush), FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
||||
public static readonly DependencyProperty DotBorderThicknessProperty = DependencyProperty.Register(
|
||||
"DotBorderThickness", typeof(double), typeof(LoadingBase),
|
||||
new FrameworkPropertyMetadata(default(double), FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
||||
public static readonly DependencyProperty DotDiameterProperty = DependencyProperty.Register(
|
||||
"DotDiameter", typeof(double), typeof(LoadingBase),
|
||||
new FrameworkPropertyMetadata(6.0, FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
||||
public static readonly DependencyProperty DotSpeedProperty = DependencyProperty.Register(
|
||||
"DotSpeed", typeof(double), typeof(LoadingBase),
|
||||
new FrameworkPropertyMetadata(4.0, FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
||||
public static readonly DependencyProperty DotDelayTimeProperty = DependencyProperty.Register(
|
||||
"DotDelayTime", typeof(double), typeof(LoadingBase),
|
||||
new FrameworkPropertyMetadata(80.0, FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
||||
protected readonly Canvas PrivateCanvas = new Canvas
|
||||
{
|
||||
ClipToBounds = true
|
||||
};
|
||||
|
||||
protected LoadingBase()
|
||||
{
|
||||
Content = PrivateCanvas;
|
||||
}
|
||||
|
||||
public int DotCount
|
||||
{
|
||||
get => (int) GetValue(DotCountProperty);
|
||||
set => SetValue(DotCountProperty, value);
|
||||
}
|
||||
|
||||
public double DotInterval
|
||||
{
|
||||
get => (double) GetValue(DotIntervalProperty);
|
||||
set => SetValue(DotIntervalProperty, value);
|
||||
}
|
||||
|
||||
public Brush DotBorderBrush
|
||||
{
|
||||
get => (Brush) GetValue(DotBorderBrushProperty);
|
||||
set => SetValue(DotBorderBrushProperty, value);
|
||||
}
|
||||
|
||||
public double DotBorderThickness
|
||||
{
|
||||
get => (double) GetValue(DotBorderThicknessProperty);
|
||||
set => SetValue(DotBorderThicknessProperty, value);
|
||||
}
|
||||
|
||||
public double DotDiameter
|
||||
{
|
||||
get => (double) GetValue(DotDiameterProperty);
|
||||
set => SetValue(DotDiameterProperty, value);
|
||||
}
|
||||
|
||||
public double DotSpeed
|
||||
{
|
||||
get => (double) GetValue(DotSpeedProperty);
|
||||
set => SetValue(DotSpeedProperty, value);
|
||||
}
|
||||
|
||||
public double DotDelayTime
|
||||
{
|
||||
get => (double) GetValue(DotDelayTimeProperty);
|
||||
set => SetValue(DotDelayTimeProperty, value);
|
||||
}
|
||||
|
||||
protected abstract void UpdateDots();
|
||||
|
||||
protected override void OnRender(DrawingContext drawingContext)
|
||||
{
|
||||
base.OnRender(drawingContext);
|
||||
UpdateDots();
|
||||
}
|
||||
|
||||
protected Ellipse CreateEllipse(int index)
|
||||
{
|
||||
var ellipse = new Ellipse();
|
||||
ellipse.SetBinding(WidthProperty, new Binding("DotDiameter") {Source = this});
|
||||
ellipse.SetBinding(HeightProperty, new Binding("DotDiameter") {Source = this});
|
||||
ellipse.SetBinding(Shape.FillProperty, new Binding("Foreground") {Source = this});
|
||||
ellipse.SetBinding(Shape.StrokeThicknessProperty, new Binding("DotBorderThickness") {Source = this});
|
||||
ellipse.SetBinding(Shape.StrokeProperty, new Binding("DotBorderBrush") {Source = this});
|
||||
return ellipse;
|
||||
}
|
||||
}
|
||||
}
|
202
HandyControl/Controls/Loading/LoadingCircle.cs
Normal file
202
HandyControl/Controls/Loading/LoadingCircle.cs
Normal file
@ -0,0 +1,202 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
public class LoadingCircle : LoadingBase
|
||||
{
|
||||
public static readonly DependencyProperty DotOffSetProperty = DependencyProperty.Register(
|
||||
"DotOffSet", typeof(double), typeof(LoadingCircle),
|
||||
new FrameworkPropertyMetadata(20.0, FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
||||
public double DotOffSet
|
||||
{
|
||||
get => (double) GetValue(DotOffSetProperty);
|
||||
set => SetValue(DotOffSetProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty NeedHiddenProperty = DependencyProperty.Register(
|
||||
"NeedHidden", typeof(bool), typeof(LoadingCircle),
|
||||
new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
||||
public bool NeedHidden
|
||||
{
|
||||
get => (bool) GetValue(NeedHiddenProperty);
|
||||
set => SetValue(NeedHiddenProperty, value);
|
||||
}
|
||||
|
||||
static LoadingCircle()
|
||||
{
|
||||
DotSpeedProperty.OverrideMetadata(typeof(LoadingCircle),
|
||||
new FrameworkPropertyMetadata(6.0, FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
DotDelayTimeProperty.OverrideMetadata(typeof(LoadingCircle),
|
||||
new FrameworkPropertyMetadata(220.0, FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
}
|
||||
|
||||
protected sealed override void UpdateDots()
|
||||
{
|
||||
if (DotCount < 1) return;
|
||||
PrivateCanvas.Children.Clear();
|
||||
|
||||
//定义动画
|
||||
Storyboard = new Storyboard
|
||||
{
|
||||
RepeatBehavior = RepeatBehavior.Forever
|
||||
};
|
||||
|
||||
//创建圆点
|
||||
for (var i = 0; i < DotCount; i++)
|
||||
{
|
||||
var border = CreateBorder(i);
|
||||
|
||||
var framesMove = new DoubleAnimationUsingKeyFrames
|
||||
{
|
||||
BeginTime = TimeSpan.FromMilliseconds(DotDelayTime * i)
|
||||
};
|
||||
|
||||
var subAngle = -DotInterval * i;
|
||||
|
||||
//开始位置
|
||||
var frame0 = new LinearDoubleKeyFrame
|
||||
{
|
||||
Value = 0 + subAngle,
|
||||
KeyTime = KeyTime.FromTimeSpan(TimeSpan.Zero)
|
||||
};
|
||||
|
||||
//开始位置到第一次匀速开始
|
||||
var frame1 = new EasingDoubleKeyFrame
|
||||
{
|
||||
EasingFunction = new PowerEase
|
||||
{
|
||||
EasingMode = EasingMode.EaseOut
|
||||
},
|
||||
Value = 180 + subAngle,
|
||||
KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(DotSpeed * (0.75 / 7)))
|
||||
};
|
||||
|
||||
//第一次匀速开始到第一次匀速结束
|
||||
var frame2 = new LinearDoubleKeyFrame
|
||||
{
|
||||
Value = 180 + DotOffSet + subAngle,
|
||||
KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(DotSpeed * (2.75 / 7)))
|
||||
};
|
||||
|
||||
//第一次匀速结束到匀加速结束
|
||||
var frame3 = new EasingDoubleKeyFrame
|
||||
{
|
||||
EasingFunction = new PowerEase
|
||||
{
|
||||
EasingMode = EasingMode.EaseIn
|
||||
},
|
||||
Value = 360 + subAngle,
|
||||
KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(DotSpeed * (3.5 / 7)))
|
||||
};
|
||||
|
||||
//匀加速结束到匀减速结束
|
||||
var frame4 = new EasingDoubleKeyFrame
|
||||
{
|
||||
EasingFunction = new PowerEase
|
||||
{
|
||||
EasingMode = EasingMode.EaseOut
|
||||
},
|
||||
Value = 540 + subAngle,
|
||||
KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(DotSpeed * (4.25 / 7)))
|
||||
};
|
||||
|
||||
//匀减速结束到第二次匀速结束
|
||||
var frame5 = new LinearDoubleKeyFrame
|
||||
{
|
||||
Value = 540 + DotOffSet + subAngle,
|
||||
KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(DotSpeed * (6.25 / 7)))
|
||||
};
|
||||
|
||||
//第二次匀速结束到匀加速结束
|
||||
var frame6 = new EasingDoubleKeyFrame
|
||||
{
|
||||
EasingFunction = new PowerEase
|
||||
{
|
||||
EasingMode = EasingMode.EaseIn
|
||||
},
|
||||
Value = 720 + subAngle,
|
||||
KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(DotSpeed))
|
||||
};
|
||||
|
||||
framesMove.KeyFrames.Add(frame0);
|
||||
framesMove.KeyFrames.Add(frame1);
|
||||
framesMove.KeyFrames.Add(frame2);
|
||||
framesMove.KeyFrames.Add(frame3);
|
||||
framesMove.KeyFrames.Add(frame4);
|
||||
framesMove.KeyFrames.Add(frame5);
|
||||
framesMove.KeyFrames.Add(frame6);
|
||||
|
||||
Storyboard.SetTarget(framesMove, border);
|
||||
Storyboard.SetTargetProperty(framesMove, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[0].(RotateTransform.Angle)"));
|
||||
Storyboard.Children.Add(framesMove);
|
||||
|
||||
if (NeedHidden)
|
||||
{
|
||||
//隐藏一段时间
|
||||
var frame7 = new DiscreteObjectKeyFrame
|
||||
{
|
||||
Value = Visibility.Collapsed,
|
||||
KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(DotSpeed))
|
||||
};
|
||||
|
||||
var frame8 = new DiscreteObjectKeyFrame
|
||||
{
|
||||
Value = Visibility.Collapsed,
|
||||
KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(DotSpeed + 0.4))
|
||||
};
|
||||
|
||||
var frame9 = new DiscreteObjectKeyFrame
|
||||
{
|
||||
Value = Visibility.Visible,
|
||||
KeyTime = KeyTime.FromTimeSpan(TimeSpan.Zero)
|
||||
};
|
||||
var framesVisibility = new ObjectAnimationUsingKeyFrames
|
||||
{
|
||||
BeginTime = TimeSpan.FromMilliseconds(DotDelayTime * i)
|
||||
};
|
||||
framesVisibility.KeyFrames.Add(frame9);
|
||||
framesVisibility.KeyFrames.Add(frame7);
|
||||
framesVisibility.KeyFrames.Add(frame8);
|
||||
Storyboard.SetTarget(framesVisibility, border);
|
||||
Storyboard.SetTargetProperty(framesVisibility, new PropertyPath("(UIElement.Visibility)"));
|
||||
Storyboard.Children.Add(framesVisibility);
|
||||
}
|
||||
PrivateCanvas.Children.Add(border);
|
||||
}
|
||||
|
||||
Storyboard.Begin();
|
||||
}
|
||||
|
||||
private Border CreateBorder(int index)
|
||||
{
|
||||
var ellipse = CreateEllipse(index);
|
||||
ellipse.HorizontalAlignment = HorizontalAlignment.Center;
|
||||
ellipse.VerticalAlignment = VerticalAlignment.Bottom;
|
||||
var rt = new RotateTransform
|
||||
{
|
||||
Angle = -DotInterval * index
|
||||
};
|
||||
var myTransGroup = new TransformGroup();
|
||||
myTransGroup.Children.Add(rt);
|
||||
var border = new Border
|
||||
{
|
||||
RenderTransformOrigin = new Point(0.5, 0.5),
|
||||
RenderTransform = myTransGroup,
|
||||
Child = ellipse,
|
||||
Visibility = NeedHidden ? Visibility.Collapsed : Visibility.Visible
|
||||
};
|
||||
border.SetBinding(WidthProperty, new Binding("Width") { Source = this });
|
||||
border.SetBinding(HeightProperty, new Binding("Height") { Source = this });
|
||||
|
||||
return border;
|
||||
}
|
||||
}
|
||||
}
|
109
HandyControl/Controls/Loading/LoadingLine.cs
Normal file
109
HandyControl/Controls/Loading/LoadingLine.cs
Normal file
@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// LoadingLine.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public class LoadingLine : LoadingBase
|
||||
{
|
||||
private const double MoveLength = 80;
|
||||
|
||||
private const double UniformScale = .6;
|
||||
|
||||
public LoadingLine()
|
||||
{
|
||||
SetBinding(HeightProperty, new Binding("DotDiameter") { Source = this });
|
||||
}
|
||||
|
||||
protected sealed override void UpdateDots()
|
||||
{
|
||||
if (DotCount < 1) return;
|
||||
PrivateCanvas.Children.Clear();
|
||||
|
||||
//计算相关尺寸
|
||||
var centerWidth = DotDiameter * DotCount + DotInterval * (DotCount - 1) + MoveLength;
|
||||
var speedDownLength = (ActualWidth - MoveLength) / 2;
|
||||
var speedUniformLength = centerWidth / 2;
|
||||
|
||||
//定义动画
|
||||
Storyboard = new Storyboard
|
||||
{
|
||||
RepeatBehavior = RepeatBehavior.Forever
|
||||
};
|
||||
|
||||
//创建圆点
|
||||
for (var i = 0; i < DotCount; i++)
|
||||
{
|
||||
var ellipse = CreateEllipse(i);
|
||||
|
||||
var frames = new ThicknessAnimationUsingKeyFrames
|
||||
{
|
||||
BeginTime = TimeSpan.FromMilliseconds(DotDelayTime * i)
|
||||
};
|
||||
//开始位置
|
||||
var frame0 = new LinearThicknessKeyFrame
|
||||
{
|
||||
Value = new Thickness(ellipse.Margin.Left, 0, 0, 0),
|
||||
KeyTime = KeyTime.FromTimeSpan(TimeSpan.Zero)
|
||||
};
|
||||
|
||||
//开始位置到匀速开始
|
||||
var frame1 = new EasingThicknessKeyFrame
|
||||
{
|
||||
EasingFunction = new PowerEase
|
||||
{
|
||||
EasingMode = EasingMode.EaseOut
|
||||
},
|
||||
Value = new Thickness(speedDownLength + ellipse.Margin.Left, 0, 0, 0),
|
||||
KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(DotSpeed * (1 - UniformScale)/2))
|
||||
};
|
||||
|
||||
//匀速开始到匀速结束
|
||||
var frame2 = new LinearThicknessKeyFrame
|
||||
{
|
||||
Value = new Thickness(speedDownLength + speedUniformLength + ellipse.Margin.Left, 0, 0, 0),
|
||||
KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(DotSpeed * (1 + UniformScale) / 2))
|
||||
};
|
||||
|
||||
//匀速结束到匀加速结束
|
||||
var frame3 = new EasingThicknessKeyFrame
|
||||
{
|
||||
EasingFunction = new PowerEase
|
||||
{
|
||||
EasingMode = EasingMode.EaseIn
|
||||
},
|
||||
Value = new Thickness(ActualWidth + ellipse.Margin.Left + speedUniformLength, 0, 0, 0),
|
||||
KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(DotSpeed))
|
||||
};
|
||||
|
||||
frames.KeyFrames.Add(frame0);
|
||||
frames.KeyFrames.Add(frame1);
|
||||
frames.KeyFrames.Add(frame2);
|
||||
frames.KeyFrames.Add(frame3);
|
||||
|
||||
Storyboard.SetTarget(frames, ellipse);
|
||||
Storyboard.SetTargetProperty(frames, new PropertyPath(MarginProperty));
|
||||
Storyboard.Children.Add(frames);
|
||||
|
||||
PrivateCanvas.Children.Add(ellipse);
|
||||
}
|
||||
|
||||
Storyboard.Begin();
|
||||
}
|
||||
|
||||
private new Ellipse CreateEllipse(int index)
|
||||
{
|
||||
var ellipse = base.CreateEllipse(index);
|
||||
ellipse.HorizontalAlignment = HorizontalAlignment.Left;
|
||||
ellipse.VerticalAlignment = VerticalAlignment.Top;
|
||||
ellipse.Margin = new Thickness(-(DotInterval + DotDiameter) * index, 0, 0, 0);
|
||||
return ellipse;
|
||||
}
|
||||
}
|
||||
}
|
@ -42,6 +42,9 @@
|
||||
<Compile Include="Controls\Info\InfoTextBox.xaml.cs">
|
||||
<DependentUpon>InfoTextBox.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\Loading\LoadingBase.cs" />
|
||||
<Compile Include="Controls\Loading\LoadingCircle.cs" />
|
||||
<Compile Include="Controls\Loading\LoadingLine.cs" />
|
||||
<Compile Include="Data\ColorRange.cs" />
|
||||
<Compile Include="Data\Enum\IpType.cs" />
|
||||
<Compile Include="Data\Enum\TextType.cs" />
|
||||
@ -159,6 +162,18 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\Base\LoadingBaseStyle.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\Base\LoadingCircleBaseStyle.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\Base\LoadingLineBaseStyle.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\Base\TextBlockBaseStyle.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@ -171,6 +186,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\Loading.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\Slider.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
10
HandyControl/Themes/Styles/Base/LoadingBaseStyle.xaml
Normal file
10
HandyControl/Themes/Styles/Base/LoadingBaseStyle.xaml
Normal file
@ -0,0 +1,10 @@
|
||||
<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">
|
||||
|
||||
<Style x:Key="LoadingBaseStyle" TargetType="{x:Type controls:LoadingBase}">
|
||||
<Setter Property="DotDiameter" Value="10"></Setter>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryBrush}"></Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
19
HandyControl/Themes/Styles/Base/LoadingCircleBaseStyle.xaml
Normal file
19
HandyControl/Themes/Styles/Base/LoadingCircleBaseStyle.xaml
Normal file
@ -0,0 +1,19 @@
|
||||
<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="LoadingBaseStyle.xaml"></ResourceDictionary>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style x:Key="LoadingCircleBaseStyle" BasedOn="{StaticResource LoadingBaseStyle}" TargetType="{x:Type controls:LoadingCircle}">
|
||||
<Setter Property="Width" Value="40"></Setter>
|
||||
<Setter Property="Height" Value="40"></Setter>
|
||||
<Setter Property="DotDiameter" Value="5"></Setter>
|
||||
<Setter Property="DotInterval" Value="30"></Setter>
|
||||
<Setter Property="DotOffSet" Value="60"></Setter>
|
||||
<Setter Property="DotDelayTime" Value="90"></Setter>
|
||||
<Setter Property="DotSpeed" Value="4"></Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
13
HandyControl/Themes/Styles/Base/LoadingLineBaseStyle.xaml
Normal file
13
HandyControl/Themes/Styles/Base/LoadingLineBaseStyle.xaml
Normal file
@ -0,0 +1,13 @@
|
||||
<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="LoadingBaseStyle.xaml"></ResourceDictionary>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style x:Key="LoadingLineBaseStyle" BasedOn="{StaticResource LoadingBaseStyle}" TargetType="{x:Type controls:LoadingLine}">
|
||||
<Setter Property="DotDiameter" Value="5"></Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
45
HandyControl/Themes/Styles/Loading.xaml
Normal file
45
HandyControl/Themes/Styles/Loading.xaml
Normal file
@ -0,0 +1,45 @@
|
||||
<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="Base/LoadingLineBaseStyle.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="Base/LoadingCircleBaseStyle.xaml"></ResourceDictionary>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<!--直线加载条默认样式-->
|
||||
<Style BasedOn="{StaticResource LoadingLineBaseStyle}" TargetType="{x:Type controls:LoadingLine}"></Style>
|
||||
|
||||
<Style x:Key="LoadingLineLight" BasedOn="{StaticResource LoadingLineBaseStyle}" TargetType="{x:Type controls:LoadingLine}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"></Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="LoadingLineLarge" BasedOn="{StaticResource LoadingLineBaseStyle}" TargetType="{x:Type controls:LoadingLine}">
|
||||
<Setter Property="DotDiameter" Value="10"></Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="LoadingLineLargeLight" BasedOn="{StaticResource LoadingLineLarge}" TargetType="{x:Type controls:LoadingLine}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"></Setter>
|
||||
</Style>
|
||||
|
||||
<!--圆形加载条默认样式-->
|
||||
<Style BasedOn="{StaticResource LoadingCircleBaseStyle}" TargetType="{x:Type controls:LoadingCircle}"></Style>
|
||||
|
||||
<Style x:Key="LoadingCircleLight" BasedOn="{StaticResource LoadingCircleBaseStyle}" TargetType="{x:Type controls:LoadingCircle}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"></Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="LoadingCircleLarge" BasedOn="{StaticResource LoadingCircleBaseStyle}" TargetType="{x:Type controls:LoadingCircle}">
|
||||
<Setter Property="Width" Value="100"></Setter>
|
||||
<Setter Property="Height" Value="100"></Setter>
|
||||
<Setter Property="DotDiameter" Value="10"></Setter>
|
||||
<Setter Property="DotInterval" Value="20"></Setter>
|
||||
<Setter Property="DotOffSet" Value="40"></Setter>
|
||||
<Setter Property="DotDelayTime" Value="120"></Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="LoadingCircleLargeLight" BasedOn="{StaticResource LoadingCircleLarge}" TargetType="{x:Type controls:LoadingCircle}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"></Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
@ -22,10 +22,10 @@
|
||||
<ResourceDictionary Source="TabControl.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="ListBox.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="ComboBox.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="Loading.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="ContextMenu.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="AnimationPath.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="ToolTip.xaml"></ResourceDictionary>-->
|
||||
<ResourceDictionary Source="Loading.xaml"></ResourceDictionary>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
</ResourceDictionary>
|
@ -3,9 +3,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
|
||||
xmlns:model="clr-namespace:HandyControlDemo.Data.Model"
|
||||
mc:Ignorable="d"
|
||||
UseLayoutRounding="True"
|
||||
Style="{StaticResource WindowDefaultStyle}"
|
||||
@ -282,7 +280,7 @@
|
||||
</Grid>
|
||||
</Border>-->
|
||||
<!--加载条-->
|
||||
<!--<Border Visibility="Collapsed" Margin="0,10,0,0" Style="{StaticResource BorderRegionStyle}">
|
||||
<Border Visibility="Collapsed" Margin="0,10,0,0" Style="{StaticResource BorderRegionStyle}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" SharedSizeGroup="Header"/>
|
||||
@ -293,20 +291,20 @@
|
||||
</StackPanel>
|
||||
<StackPanel VerticalAlignment="Center" Margin="50,0,0,0" Grid.Column="1">
|
||||
<controls:LoadingLine></controls:LoadingLine>
|
||||
<controls:LoadingLine Margin="0,30" Style="{StaticResource LoadingLineLarge}"></controls:LoadingLine>
|
||||
<controls:LoadingLine Margin="0,30" Foreground="BlueViolet" Style="{StaticResource LoadingLineLarge}"></controls:LoadingLine>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<controls:LoadingCircle></controls:LoadingCircle>
|
||||
<Border VerticalAlignment="Center" Background="{DynamicResource PrimaryBrush}" CornerRadius="10">
|
||||
<controls:LoadingCircle Style="{StaticResource LoadingCircleLight}" Margin="10"></controls:LoadingCircle>
|
||||
</Border>
|
||||
<controls:LoadingCircle Margin="30,0,0,0" Style="{StaticResource LoadingCircleLarge}"></controls:LoadingCircle>
|
||||
<Border Background="{DynamicResource PrimaryBrush}" CornerRadius="10">
|
||||
<controls:LoadingCircle Width="50" Height="50" DotCount="4" DotDiameter="20" DotInterval="90" DotDelayTime="500" DotOffSet="10" Foreground="OrangeRed" Margin="30,0,0,0" Style="{StaticResource LoadingCircleLarge}"></controls:LoadingCircle>
|
||||
<!--<Border Background="{DynamicResource PrimaryBrush}" CornerRadius="10">
|
||||
<controls:LoadingCircle Margin="10" Style="{StaticResource LoadingCircleLargeLight}"></controls:LoadingCircle>
|
||||
</Border>
|
||||
</Border>-->
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>-->
|
||||
</Border>
|
||||
<!--SVG动画-->
|
||||
<!--<Border Visibility="Collapsed" Margin="0,10,0,0" Style="{StaticResource BorderRegionStyle}">
|
||||
<Grid>
|
||||
|
Loading…
Reference in New Issue
Block a user