diff --git a/HandyControl/Controls/StepBar/StepBar.cs b/HandyControl/Controls/StepBar/StepBar.cs
new file mode 100644
index 00000000..cdfcde62
--- /dev/null
+++ b/HandyControl/Controls/StepBar/StepBar.cs
@@ -0,0 +1,157 @@
+using System;
+using System.ComponentModel;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Input;
+using System.Windows.Media;
+using HandyControl.Data;
+using HandyControl.Interactivity;
+using HandyControl.Tools;
+
+namespace HandyControl.Controls
+{
+ [StyleTypedProperty(Property = "ItemContainerStyle", StyleTargetType = typeof(StepBarItem))]
+ [DefaultEvent("StepChanged")]
+ [TemplatePart(Name = ElementProgressBarBack, Type = typeof(ProgressBar))]
+ public class StepBar : ItemsControl
+ {
+ private ProgressBar _progressBarBack;
+
+ #region Constants
+
+ private const string ElementProgressBarBack = "PART_ProgressBarBack";
+
+ #endregion Constants
+
+ public StepBar()
+ {
+ CommandBindings.Add(new CommandBinding(ControlCommands.Next, (s, e) => Next()));
+ CommandBindings.Add(new CommandBinding(ControlCommands.Prev, (s, e) => Prev()));
+ ItemContainerGenerator.StatusChanged += ItemContainerGenerator_StatusChanged;
+ }
+
+ private void ItemContainerGenerator_StatusChanged(object sender, EventArgs e)
+ {
+ var count = Items.Count;
+ if (count > 0)
+ {
+ if (ItemContainerGenerator.ContainerFromIndex(0) is StepBarItem item)
+ {
+ item.Status = StepStatus.UnderWay;
+ }
+
+ for (int i = 0; i < count; i++)
+ {
+ if (ItemContainerGenerator.ContainerFromIndex(i) is StepBarItem stepBarItem)
+ {
+ stepBarItem.Index = i + 1;
+ }
+ }
+ }
+ }
+
+ protected override bool IsItemItsOwnContainerOverride(object item) => item is StepBarItem;
+
+ protected override DependencyObject GetContainerForItemOverride() => new StepBarItem();
+
+ ///
+ /// 步骤改变事件
+ ///
+ public static readonly RoutedEvent StepChangedEvent =
+ EventManager.RegisterRoutedEvent("StepChanged", RoutingStrategy.Bubble,
+ typeof(EventHandler>), typeof(StepBar));
+
+ ///
+ /// 步骤改变事件
+ ///
+ [Category("Behavior")]
+ public event EventHandler> StepChanged
+ {
+ add => AddHandler(StepChangedEvent, value);
+ remove => RemoveHandler(StepChangedEvent, value);
+ }
+
+ public static readonly DependencyProperty StepIndexProperty = DependencyProperty.Register(
+ "StepIndex", typeof(int), typeof(StepBar), new PropertyMetadata(default(int)));
+
+ public int StepIndex
+ {
+ get => (int) GetValue(StepIndexProperty);
+ protected set => SetValue(StepIndexProperty, value);
+ }
+
+ public static readonly DependencyProperty DockProperty = DependencyProperty.Register(
+ "Dock", typeof(Dock), typeof(StepBar), new PropertyMetadata(Dock.Top));
+
+ public Dock Dock
+ {
+ get => (Dock) GetValue(DockProperty);
+ set => SetValue(DockProperty, value);
+ }
+
+ public override void OnApplyTemplate()
+ {
+ base.OnApplyTemplate();
+
+ _progressBarBack = GetTemplateChild(ElementProgressBarBack) as ProgressBar;
+ }
+
+ protected override void OnRender(DrawingContext drawingContext)
+ {
+ base.OnRender(drawingContext);
+
+ var colCount = Items.Count;
+ if (_progressBarBack == null || colCount <= 0) return;
+ _progressBarBack.Maximum = colCount - 1;
+ _progressBarBack.Value = StepIndex;
+
+ if (Dock == Dock.Top || Dock == Dock.Bottom)
+ {
+ _progressBarBack.Width = (colCount - 1) * (ActualWidth / colCount);
+ }
+ else
+ {
+ _progressBarBack.Height = (colCount - 1) * (ActualHeight / colCount);
+ }
+ }
+
+ public void Next()
+ {
+ StepIndex++;
+ if (StepIndex >= Items.Count)
+ {
+ StepIndex = Items.Count - 1;
+ return;
+ }
+ RaiseEvent(new FunctionEventArgs(StepChangedEvent, this)
+ {
+ Info = StepIndex
+ });
+ if (ItemContainerGenerator.ContainerFromIndex(StepIndex - 1) is StepBarItem stepItemFinished)
+ stepItemFinished.Status = StepStatus.Complete;
+ if (ItemContainerGenerator.ContainerFromIndex(StepIndex) is StepBarItem stepItemSelected)
+ stepItemSelected.Status = StepStatus.UnderWay;
+ _progressBarBack?.BeginAnimation(RangeBase.ValueProperty, AnimationHelper.CreateAnimation(StepIndex));
+ }
+
+ public void Prev()
+ {
+ StepIndex--;
+ if (StepIndex < 0)
+ {
+ StepIndex = 0;
+ return;
+ }
+ RaiseEvent(new FunctionEventArgs(StepChangedEvent, this)
+ {
+ Info = StepIndex
+ });
+ if (ItemContainerGenerator.ContainerFromIndex(StepIndex + 1) is StepBarItem stepItemWaiting)
+ stepItemWaiting.Status = StepStatus.Waiting;
+ if (ItemContainerGenerator.ContainerFromIndex(StepIndex) is StepBarItem stepItemSelected)
+ stepItemSelected.Status = StepStatus.UnderWay;
+ _progressBarBack?.BeginAnimation(RangeBase.ValueProperty, AnimationHelper.CreateAnimation(StepIndex));
+ }
+ }
+}
\ No newline at end of file
diff --git a/HandyControl/Controls/StepBar/StepBarItem.cs b/HandyControl/Controls/StepBar/StepBarItem.cs
new file mode 100644
index 00000000..e69a6e6a
--- /dev/null
+++ b/HandyControl/Controls/StepBar/StepBarItem.cs
@@ -0,0 +1,42 @@
+using System.Windows;
+using System.Windows.Controls;
+using HandyControl.Data;
+
+namespace HandyControl.Controls
+{
+ ///
+ /// 步骤条单元项
+ ///
+ public class StepBarItem : ContentControl
+ {
+ ///
+ /// 步骤编号
+ ///
+ public static readonly DependencyProperty IndexProperty = DependencyProperty.Register(
+ "Index", typeof(int), typeof(StepBarItem), new PropertyMetadata(-1));
+
+ ///
+ /// 步骤编号
+ ///
+ public int Index
+ {
+ get => (int) GetValue(IndexProperty);
+ internal set => SetValue(IndexProperty, value);
+ }
+
+ ///
+ /// 步骤状态
+ ///
+ public static readonly DependencyProperty StatusProperty = DependencyProperty.Register(
+ "Status", typeof(StepStatus), typeof(StepBarItem), new PropertyMetadata(StepStatus.Waiting));
+
+ ///
+ /// 步骤状态
+ ///
+ public StepStatus Status
+ {
+ get => (StepStatus) GetValue(StatusProperty);
+ internal set => SetValue(StatusProperty, value);
+ }
+ }
+}
\ No newline at end of file
diff --git a/HandyControl/Controls/Steps/StepBar.cs b/HandyControl/Controls/Steps/StepBar.cs
deleted file mode 100644
index 15654df5..00000000
--- a/HandyControl/Controls/Steps/StepBar.cs
+++ /dev/null
@@ -1,162 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Controls.Primitives;
-using System.Windows.Input;
-using System.Windows.Markup;
-using System.Windows.Media;
-using HandyControl.Data;
-using HandyControl.Interactivity;
-using HandyControl.Tools;
-
-// ReSharper disable once CheckNamespace
-namespace HandyControl.Controls
-{
- ///
- /// 步骤条
- ///
- [ContentProperty("Items")]
- [TemplatePart(Name = ElementProgressBarBack, Type = typeof(ProgressBar))]
- [TemplatePart(Name = ElementUniformGridMain, Type = typeof(Panel))]
- public class StepBar : Control
- {
- private bool _isLoaded;
-
- private ProgressBar _progressBarBack;
-
- private Panel _panelMain;
-
- #region Constants
-
- private const string ElementProgressBarBack = "PART_ProgressBarBack";
- private const string ElementUniformGridMain = "PART_UniformGridMain";
-
- #endregion Constants
-
- ///
- /// 步骤改变事件
- ///
- public static readonly RoutedEvent StepChangedEvent =
- EventManager.RegisterRoutedEvent("StepChanged", RoutingStrategy.Bubble,
- typeof(EventHandler>), typeof(StepBar));
-
- ///
- /// 步骤改变事件
- ///
- public event EventHandler> StepChanged
- {
- add => AddHandler(StepChangedEvent, value);
- remove => RemoveHandler(StepChangedEvent, value);
- }
-
- public StepBar()
- {
- Loaded += (s1, e1) =>
- {
- if (_isLoaded) return;
- UpdateItems(Items);
-
- CommandBindings.Add(new CommandBinding(ControlCommands.Next, (s, e) => Next()));
- CommandBindings.Add(new CommandBinding(ControlCommands.Prev, (s, e) => Prev()));
-
- _isLoaded = true;
- };
- }
-
- public override void OnApplyTemplate()
- {
- _panelMain?.Children.Clear();
- base.OnApplyTemplate();
-
- _progressBarBack = GetTemplateChild(ElementProgressBarBack) as ProgressBar;
- _panelMain = GetTemplateChild(ElementUniformGridMain) as Panel;
-
- CheckNull();
-
- if (_isLoaded)
- {
- UpdateItems(Items);
- }
- }
-
- private void CheckNull()
- {
- if (_panelMain == null || _progressBarBack == null) throw new Exception();
- }
-
- public int StepIndex { get; private set; }
-
- public List Items { get; set; } = new List();
-
- private void UpdateItems(IReadOnlyCollection list)
- {
- if (list == null) return;
- _panelMain.Children.Clear();
-
- var index = 1;
- foreach (var item in list)
- {
- item.Index = index;
- item.IndexStr = $"{Properties.Langs.Lang.Step}{index}";
- _panelMain.Children.Add(item);
- index++;
- }
-
- if (list.FirstOrDefault() is StepItem stepItem)
- {
- stepItem.Status = false;
- }
- }
-
- protected override void OnRender(DrawingContext drawingContext)
- {
- base.OnRender(drawingContext);
-
- var colCount = _panelMain.Children.Count;
- if (colCount <= 0) return;
- _progressBarBack.Width = (colCount - 1) * (ActualWidth / colCount);
- _progressBarBack.Value = 0;
- _progressBarBack.Maximum = colCount - 1;
- }
-
- public void Next()
- {
- StepIndex++;
- if (StepIndex >= _panelMain.Children.Count)
- {
- StepIndex = _panelMain.Children.Count - 1;
- return;
- }
- RaiseEvent(new FunctionEventArgs(StepChangedEvent, this)
- {
- Info = StepIndex
- });
- if (_panelMain.Children[StepIndex - 1] is StepItem stepItemFinished)
- stepItemFinished.Status = true;
- if (_panelMain.Children[StepIndex] is StepItem stepItemSelected)
- stepItemSelected.Status = false;
- _progressBarBack.BeginAnimation(RangeBase.ValueProperty, AnimationHelper.CreateAnimation(StepIndex));
- }
-
- public void Prev()
- {
- StepIndex--;
- if (StepIndex < 0)
- {
- StepIndex = 0;
- return;
- }
- RaiseEvent(new FunctionEventArgs(StepChangedEvent, this)
- {
- Info = StepIndex
- });
- if (_panelMain.Children[StepIndex + 1] is StepItem stepItemFinished)
- stepItemFinished.Status = null;
- if (_panelMain.Children[StepIndex] is StepItem stepItemSelected)
- stepItemSelected.Status = false;
- _progressBarBack.BeginAnimation(RangeBase.ValueProperty, AnimationHelper.CreateAnimation(StepIndex));
- }
- }
-}
\ No newline at end of file
diff --git a/HandyControl/Controls/Steps/StepItem.cs b/HandyControl/Controls/Steps/StepItem.cs
deleted file mode 100644
index 86deb2fe..00000000
--- a/HandyControl/Controls/Steps/StepItem.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Media;
-using HandyControl.Data;
-using HandyControl.Tools;
-
-// ReSharper disable once CheckNamespace
-namespace HandyControl.Controls
-{
- ///
- /// 步骤条单元项
- ///
- public class StepItem : Control
- {
- internal static readonly DependencyProperty IndexProperty = DependencyProperty.Register(
- "Index", typeof(int), typeof(StepItem), new PropertyMetadata(-1));
-
- internal int Index
- {
- get => (int)GetValue(IndexProperty);
- set => SetValue(IndexProperty, value);
- }
-
- internal static readonly DependencyProperty IndexStrProperty = DependencyProperty.Register(
- "IndexStr", typeof(string), typeof(StepItem), new PropertyMetadata(default(string)));
-
- internal string IndexStr
- {
- get => (string)GetValue(IndexStrProperty);
- set => SetValue(IndexStrProperty, value);
- }
-
- public static readonly DependencyProperty TitleProperty = DependencyProperty.Register(
- "Title", typeof(string), typeof(StepItem), new PropertyMetadata(default(string)));
-
- public string Title
- {
- get => (string)GetValue(TitleProperty);
- set => SetValue(TitleProperty, value);
- }
-
- private bool? _status;
-
- public bool? Status
- {
- get => _status;
- set
- {
- _status = value;
- UpdateStatus();
- }
- }
-
- private void UpdateStatus()
- {
- if (Status == true)
- {
- Foreground = ResourceHelper.GetResource(ResourceToken.PrimaryTextBrush);
- }
- else if (Status == false)
- {
- Foreground = ResourceHelper.GetResource(ResourceToken.PrimaryBrush);
- }
- else
- {
- Foreground = ResourceHelper.GetResource(ResourceToken.ThirdlyTextBrush);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/HandyControl/Controls/TransitioningContentControl.cs b/HandyControl/Controls/TransitioningContentControl.cs
index 6a0e84f8..4712eb7a 100644
--- a/HandyControl/Controls/TransitioningContentControl.cs
+++ b/HandyControl/Controls/TransitioningContentControl.cs
@@ -1,4 +1,5 @@
using System;
+using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Windows;
@@ -18,7 +19,10 @@ namespace HandyControl.Controls
public TransitioningContentControl()
{
- DefaultStyleKey = typeof(TransitioningContentControl);
+ if (!DesignerProperties.GetIsInDesignMode(this))
+ {
+ DefaultStyleKey = typeof(TransitioningContentControl);
+ }
}
private Storyboard CurrentTransition
@@ -43,6 +47,8 @@ namespace HandyControl.Controls
public override void OnApplyTemplate()
{
+ if (DesignerProperties.GetIsInDesignMode(this)) return;
+
if (IsTransitioning)
AbortTransition();
diff --git a/HandyControl/Data/Enum/StepStatus.cs b/HandyControl/Data/Enum/StepStatus.cs
new file mode 100644
index 00000000..1c46c467
--- /dev/null
+++ b/HandyControl/Data/Enum/StepStatus.cs
@@ -0,0 +1,23 @@
+namespace HandyControl.Data
+{
+ ///
+ /// 步骤状态
+ ///
+ public enum StepStatus
+ {
+ ///
+ /// 完成
+ ///
+ Complete,
+
+ ///
+ /// 进行中
+ ///
+ UnderWay,
+
+ ///
+ /// 等待中
+ ///
+ Waiting
+ }
+}
\ No newline at end of file
diff --git a/HandyControl/HandyControl.csproj b/HandyControl/HandyControl.csproj
index 465401dc..a480ea86 100644
--- a/HandyControl/HandyControl.csproj
+++ b/HandyControl/HandyControl.csproj
@@ -65,9 +65,12 @@
+
+
+
@@ -110,8 +113,6 @@
-
-
@@ -266,6 +267,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/HandyControl/Properties/Langs/Lang.Designer.cs b/HandyControl/Properties/Langs/Lang.Designer.cs
index 9b13e3fc..e393484a 100644
--- a/HandyControl/Properties/Langs/Lang.Designer.cs
+++ b/HandyControl/Properties/Langs/Lang.Designer.cs
@@ -47,7 +47,7 @@ namespace HandyControl.Properties.Langs {
}
///
- /// 重写当前线程的 CurrentUICulture 属性
+ /// 使用此强类型资源类,为所有资源查找
/// 重写当前线程的 CurrentUICulture 属性。
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
@@ -78,6 +78,24 @@ namespace HandyControl.Properties.Langs {
}
}
+ ///
+ /// 查找类似 无法自注册复合命令 的本地化字符串。
+ ///
+ public static string CannotRegisterCompositeCommandInItself {
+ get {
+ return ResourceManager.GetString("CannotRegisterCompositeCommandInItself", resourceCulture);
+ }
+ }
+
+ ///
+ /// 查找类似 不能注册同一命令两次 的本地化字符串。
+ ///
+ public static string CannotRegisterSameCommandTwice {
+ get {
+ return ResourceManager.GetString("CannotRegisterSameCommandTwice", resourceCulture);
+ }
+ }
+
///
/// 查找类似 清空 的本地化字符串。
///
@@ -249,15 +267,6 @@ namespace HandyControl.Properties.Langs {
}
}
- ///
- /// 查找类似 步骤 的本地化字符串。
- ///
- public static string Step {
- get {
- return ResourceManager.GetString("Step", resourceCulture);
- }
- }
-
///
/// 查找类似 提示 的本地化字符串。
///
diff --git a/HandyControl/Properties/Langs/Lang.en.resx b/HandyControl/Properties/Langs/Lang.en.resx
index b6ba11e5..162027ec 100644
--- a/HandyControl/Properties/Langs/Lang.en.resx
+++ b/HandyControl/Properties/Langs/Lang.en.resx
@@ -165,9 +165,6 @@
Clear
-
- Step
-
Close
@@ -195,4 +192,10 @@
format error
+
+ Cannot Register Composite Command In It self
+
+
+ Cannot Register Same Command Twice
+
\ No newline at end of file
diff --git a/HandyControl/Properties/Langs/Lang.resx b/HandyControl/Properties/Langs/Lang.resx
index 7c115a14..078dabdf 100644
--- a/HandyControl/Properties/Langs/Lang.resx
+++ b/HandyControl/Properties/Langs/Lang.resx
@@ -145,9 +145,6 @@
清空
-
- 步骤
-
关闭
@@ -175,4 +172,10 @@
格式错误
+
+ 无法自注册复合命令
+
+
+ 不能注册同一命令两次
+
\ No newline at end of file
diff --git a/HandyControl/Themes/Styles/Base/StepBarBaseStyle.xaml b/HandyControl/Themes/Styles/Base/StepBarBaseStyle.xaml
new file mode 100644
index 00000000..06e48c1c
--- /dev/null
+++ b/HandyControl/Themes/Styles/Base/StepBarBaseStyle.xaml
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HandyControl/Themes/Styles/ProgressBar.xaml b/HandyControl/Themes/Styles/ProgressBar.xaml
index f6916e85..ce272123 100644
--- a/HandyControl/Themes/Styles/ProgressBar.xaml
+++ b/HandyControl/Themes/Styles/ProgressBar.xaml
@@ -206,11 +206,18 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/HandyControl/Themes/Styles/StepBar.xaml b/HandyControl/Themes/Styles/StepBar.xaml
index 898f8e22..ad8946a0 100644
--- a/HandyControl/Themes/Styles/StepBar.xaml
+++ b/HandyControl/Themes/Styles/StepBar.xaml
@@ -2,39 +2,9 @@
xmlns:controls="clr-namespace:HandyControl.Controls">
-
-
+
-
-
-
+
\ No newline at end of file
diff --git a/HandyControlDemo/Data/Model/StepBarDemoModel.cs b/HandyControlDemo/Data/Model/StepBarDemoModel.cs
new file mode 100644
index 00000000..7cd77a20
--- /dev/null
+++ b/HandyControlDemo/Data/Model/StepBarDemoModel.cs
@@ -0,0 +1,9 @@
+namespace HandyControlDemo.Data
+{
+ public class StepBarDemoModel
+ {
+ public string Header { get; set; }
+
+ public string Content { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/HandyControlDemo/HandyControlDemo.csproj b/HandyControlDemo/HandyControlDemo.csproj
index 7103694b..446b5e9c 100644
--- a/HandyControlDemo/HandyControlDemo.csproj
+++ b/HandyControlDemo/HandyControlDemo.csproj
@@ -79,6 +79,7 @@
+
True
True
@@ -235,6 +236,7 @@
+
diff --git a/HandyControlDemo/Properties/Langs/Lang.Designer.cs b/HandyControlDemo/Properties/Langs/Lang.Designer.cs
index 23798ae4..72f792c7 100644
--- a/HandyControlDemo/Properties/Langs/Lang.Designer.cs
+++ b/HandyControlDemo/Properties/Langs/Lang.Designer.cs
@@ -47,7 +47,7 @@ namespace HandyControlDemo.Properties.Langs {
}
///
- /// 重写当前线程的 CurrentUICulture 属性
+ /// 使用此强类型资源类,为所有资源查找
/// 重写当前线程的 CurrentUICulture 属性。
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
@@ -717,6 +717,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
+ ///
+ /// 查找类似 步骤 的本地化字符串。
+ ///
+ public static string Step {
+ get {
+ return ResourceManager.GetString("Step", resourceCulture);
+ }
+ }
+
///
/// 查找类似 步骤条 的本地化字符串。
///
diff --git a/HandyControlDemo/Properties/Langs/Lang.en.resx b/HandyControlDemo/Properties/Langs/Lang.en.resx
index f570ea38..7a38c4e6 100644
--- a/HandyControlDemo/Properties/Langs/Lang.en.resx
+++ b/HandyControlDemo/Properties/Langs/Lang.en.resx
@@ -396,4 +396,7 @@
please enter email
+
+ Step
+
\ No newline at end of file
diff --git a/HandyControlDemo/Properties/Langs/Lang.resx b/HandyControlDemo/Properties/Langs/Lang.resx
index e12ce8eb..bb77a022 100644
--- a/HandyControlDemo/Properties/Langs/Lang.resx
+++ b/HandyControlDemo/Properties/Langs/Lang.resx
@@ -376,4 +376,7 @@
请输入邮箱
+
+ 步骤
+
\ No newline at end of file
diff --git a/HandyControlDemo/Service/DataService.cs b/HandyControlDemo/Service/DataService.cs
index 33324a2e..8f8ee1a4 100644
--- a/HandyControlDemo/Service/DataService.cs
+++ b/HandyControlDemo/Service/DataService.cs
@@ -11,7 +11,7 @@ namespace HandyControlDemo.Service
{
public class DataService
{
- public List GetDemoDataList()
+ internal List GetDemoDataList()
{
var list = new List();
for (var i = 1; i <= 6; i++)
@@ -43,7 +43,7 @@ namespace HandyControlDemo.Service
return list;
}
- public List GetComboBoxDemoDataList()
+ internal List GetComboBoxDemoDataList()
{
var converter = new StringRepeatConverter();
var list = new List();
@@ -55,7 +55,7 @@ namespace HandyControlDemo.Service
return list;
}
- public List GetContributorDataList()
+ internal List GetContributorDataList()
{
var client = new WebClient();
client.Headers.Add("User-Agent", "request");
@@ -77,5 +77,32 @@ namespace HandyControlDemo.Service
}
return list;
}
+
+ internal List GetStepBarDemoDataList()
+ {
+ return new List
+ {
+ new StepBarDemoModel
+ {
+ Header = $"{Properties.Langs.Lang.Step}1",
+ Content = Properties.Langs.Lang.Register
+ },
+ new StepBarDemoModel
+ {
+ Header = $"{Properties.Langs.Lang.Step}2",
+ Content = Properties.Langs.Lang.BasicInfo
+ },
+ new StepBarDemoModel
+ {
+ Header = $"{Properties.Langs.Lang.Step}3",
+ Content = Properties.Langs.Lang.UploadFile
+ },
+ new StepBarDemoModel
+ {
+ Header = $"{Properties.Langs.Lang.Step}4",
+ Content = Properties.Langs.Lang.Complete
+ }
+ };
+ }
}
}
\ No newline at end of file
diff --git a/HandyControlDemo/UserControl/Controls/StepBarDemoCtl.xaml b/HandyControlDemo/UserControl/Controls/StepBarDemoCtl.xaml
index 1dcee539..581718ca 100644
--- a/HandyControlDemo/UserControl/Controls/StepBarDemoCtl.xaml
+++ b/HandyControlDemo/UserControl/Controls/StepBarDemoCtl.xaml
@@ -3,21 +3,57 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
- xmlns:interactivity="clr-namespace:HandyControl.Interactivity;assembly=HandyControl"
+ DataContext="{Binding StepBarDemo,Source={StaticResource Locator}}"
FocusManager.FocusedElement="{Binding RelativeSource={x:Static RelativeSource.Self}, Mode=OneTime}"
Background="{DynamicResource RegionBrush}">
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/HandyControlDemo/UserControl/Main/LeftMainContent.xaml b/HandyControlDemo/UserControl/Main/LeftMainContent.xaml
index ac904bce..a25354e4 100644
--- a/HandyControlDemo/UserControl/Main/LeftMainContent.xaml
+++ b/HandyControlDemo/UserControl/Main/LeftMainContent.xaml
@@ -124,12 +124,12 @@
-
+
-
+
@@ -154,7 +154,7 @@
-
+
diff --git a/HandyControlDemo/ViewModel/StepBarDemoViewModel.cs b/HandyControlDemo/ViewModel/StepBarDemoViewModel.cs
new file mode 100644
index 00000000..fd2fd56b
--- /dev/null
+++ b/HandyControlDemo/ViewModel/StepBarDemoViewModel.cs
@@ -0,0 +1,60 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Controls;
+using GalaSoft.MvvmLight;
+using GalaSoft.MvvmLight.CommandWpf;
+using HandyControl.Controls;
+using HandyControlDemo.Data;
+using HandyControlDemo.Service;
+
+namespace HandyControlDemo.ViewModel
+{
+ public class StepBarDemoViewModel : ViewModelBase
+ {
+ ///
+ /// 数据列表
+ ///
+ private List _dataList;
+
+ ///
+ /// 数据列表
+ ///
+ public List DataList
+ {
+ get => _dataList;
+ set => Set(ref _dataList, value);
+ }
+
+ public StepBarDemoViewModel(DataService dataService)
+ {
+ DataList = dataService.GetStepBarDemoDataList();
+ }
+
+ ///
+ /// 下一步
+ ///
+ public RelayCommand NextCmd => new Lazy>(() => new RelayCommand(Next)).Value;
+
+ ///
+ /// 上一步
+ ///
+ public RelayCommand PrevCmd => new Lazy>(() => new RelayCommand(Prev)).Value;
+
+ private void Next(Panel panel)
+ {
+ foreach (var stepBar in panel.Children.OfType())
+ {
+ stepBar.Next();
+ }
+ }
+
+ private void Prev(Panel panel)
+ {
+ foreach (var stepBar in panel.Children.OfType())
+ {
+ stepBar.Prev();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/HandyControlDemo/ViewModel/ViewModelLocator.cs b/HandyControlDemo/ViewModel/ViewModelLocator.cs
index fa60cf95..88943f11 100644
--- a/HandyControlDemo/ViewModel/ViewModelLocator.cs
+++ b/HandyControlDemo/ViewModel/ViewModelLocator.cs
@@ -20,6 +20,7 @@ namespace HandyControlDemo.ViewModel
SimpleIoc.Default.Register();
SimpleIoc.Default.Register();
SimpleIoc.Default.Register();
+ SimpleIoc.Default.Register();
}
public static ViewModelLocator Instance => new Lazy(() =>
@@ -39,6 +40,8 @@ namespace HandyControlDemo.ViewModel
public ContributorsViewModel ContributorsView => ServiceLocator.Current.GetInstance();
+ public StepBarDemoViewModel StepBarDemo => ServiceLocator.Current.GetInstance();
+
#endregion
}
}
\ No newline at end of file
diff --git a/README.md b/README.md
index c5695afa..90276de0 100644
--- a/README.md
+++ b/README.md
@@ -6,15 +6,19 @@
## Latest examples
-### 1、CircleProgressBar
+### 1、Slider
+
+
+
+### 2、CircleProgressBar

-### 2、DataGrid
+### 3、DataGrid

-### 3、Now you can switch to dark theme
+### 4、Now you can switch to dark theme

@@ -72,7 +76,7 @@
### 13、StepBar
-
+
### 14、Calendar
diff --git a/Resources/Slider.png b/Resources/Slider.png
new file mode 100644
index 00000000..9386eb92
Binary files /dev/null and b/Resources/Slider.png differ
diff --git a/Resources/StepBar.gif b/Resources/StepBar.gif
deleted file mode 100644
index 4a441d4b..00000000
Binary files a/Resources/StepBar.gif and /dev/null differ
diff --git a/Resources/StepBar.png b/Resources/StepBar.png
new file mode 100644
index 00000000..d32b4d9e
Binary files /dev/null and b/Resources/StepBar.png differ