diff --git a/ChangeLog.txt b/ChangeLog.txt
deleted file mode 100644
index b60bbce0..00000000
--- a/ChangeLog.txt
+++ /dev/null
@@ -1,78 +0,0 @@
-2018.10.09 Version 1.3.2
-* new style
- - add TabControl
-
-* fixed bug
- - ColorPicker's text is gone.
-
-2018.10.09 Version 1.3.1
-* new style
- - add TextBox
- - add ComboBox
- - add PasswordBox
- - add DataPicker
- - add TimePicker
-
-* other
- - add TextBlockDemo
- - add CirclePanelDemo
-
-2018.10.03 Version 1.3.0
-* new controls
- - add Clock
- - add TimePicker
- - add CirclePanel
-
-* new style
- - add Calendar
- - add DataPicker
-
-2018.09.18 Version 1.2.2
-* new controls
- - add StepBar
-
-* other
-- update HandyControlDemo UI
-
-2018.09.04 Version 1.2.1
-* new controls
- - add TabControl
- - add ContextMenuButton
- - add ContextMenuToggleButton
-
-* other
-- update HandyControlDemo UI
-- Localization
-
-2018.09.04 Version 1.2.0
-* new controls
- - add Growl
- - add AnimationPath
- - add TransitioningContentControl
-
-* new style
- - add ProgressBar
- - add TreeView
-
-* other
-- update HandyControlDemo UI
-- the ScrollViewer will auto hidden
-
-2018.08.31 Version 1.1.2
-* new controls
- - add CompareSlider
-
-2018.08.30 Version 1.1.1
-* new controls
- - add ScrollViewer
-
-2018.08.27 Version 1.1.0
-
-* new controls
- - add WindowBorderless
- - add ImageBrowser
- - add PopupWindow
-
-* new styles
- - add Menu
- - add Window
\ No newline at end of file
diff --git a/HandyControl/Controls/Carousel.xaml.cs b/HandyControl/Controls/Carousel.cs
similarity index 69%
rename from HandyControl/Controls/Carousel.xaml.cs
rename to HandyControl/Controls/Carousel.cs
index 94a460e5..ec47d5f1 100644
--- a/HandyControl/Controls/Carousel.xaml.cs
+++ b/HandyControl/Controls/Carousel.cs
@@ -1,25 +1,75 @@
using System;
-using System.Collections;
using System.Collections.Generic;
+using System.Collections.Specialized;
using System.ComponentModel;
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 System.Windows.Threading;
+using HandyControl.Interactivity;
using HandyControl.Tools;
namespace HandyControl.Controls
{
///
- /// Carousel.xaml 的交互逻辑
+ /// 轮播控件
///
[DefaultProperty("Items")]
[ContentProperty("Items")]
- public partial class Carousel
+ [TemplatePart(Name = ElementPanelPage, Type = typeof(Panel))]
+ [TemplatePart(Name = ElementItemsControl, Type = typeof(ItemsPresenter))]
+ public class Carousel : ListBox
{
+ #region Constants
+
+ private const string ElementPanelPage = "PART_PanelPage";
+ private const string ElementItemsControl = "PART_ItemsControl";
+
+ #endregion Constants
+
+ #region Data
+
+ private Panel _panelPage;
+
+ private bool _appliedTemplate;
+
+ private ItemsPresenter _itemsControl;
+
+ #endregion Data
+
+ public override void OnApplyTemplate()
+ {
+ _appliedTemplate = false;
+
+ _panelPage?.RemoveHandler(ButtonBase.ClickEvent, new RoutedEventHandler(ButtonPages_OnClick));
+
+ base.OnApplyTemplate();
+
+ _itemsControl = GetTemplateChild(ElementItemsControl) as ItemsPresenter;
+ _panelPage = GetTemplateChild(ElementPanelPage) as Panel;
+
+ CheckNull();
+
+ _panelPage.AddHandler(ButtonBase.ClickEvent, new RoutedEventHandler(ButtonPages_OnClick));
+ _appliedTemplate = true;
+ Update();
+ }
+
+ private void Update()
+ {
+ TimerSwitch(AutoRun);
+ UpdatePageButtons();
+ }
+
+ private void CheckNull()
+ {
+ if (_itemsControl == null || _panelPage == null) throw new Exception();
+ }
+
public static readonly DependencyProperty AutoRunProperty = DependencyProperty.Register(
"AutoRun", typeof(bool), typeof(Carousel), new PropertyMetadata(default(bool), (o, args) =>
{
@@ -30,14 +80,6 @@ namespace HandyControl.Controls
public static readonly DependencyProperty IntervalProperty = DependencyProperty.Register(
"Interval", typeof(TimeSpan), typeof(Carousel), new PropertyMetadata(TimeSpan.FromSeconds(2)));
- public static readonly DependencyProperty ItemsSourceProperty = DependencyProperty.Register(
- "ItemsSource", typeof(IEnumerable), typeof(Carousel), new PropertyMetadata(default(IEnumerable),
- (o, args) =>
- {
- var ctl = (Carousel)o;
- ctl.UpdatePageButtons();
- }));
-
public static readonly DependencyProperty ExtendWidthProperty = DependencyProperty.Register(
"ExtendWidth", typeof(double), typeof(Carousel), new PropertyMetadata(default(double)));
@@ -56,7 +98,7 @@ namespace HandyControl.Controls
set => SetValue(IsCenterProperty, value);
}
- private int _pageIndex = -1;
+ private int _pageIndex;
private Button _selectedButton;
@@ -66,11 +108,20 @@ namespace HandyControl.Controls
public Carousel()
{
- InitializeComponent();
+ CommandBindings.Add(new CommandBinding(ControlCommands.Prev, ButtonPrev_OnClick));
+ CommandBindings.Add(new CommandBinding(ControlCommands.Next, ButtonNext_OnClick));
+ CommandBindings.Add(new CommandBinding(ControlCommands.Selected, ButtonPages_OnClick));
Loaded += (s, e) => UpdatePageButtons();
}
+ protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
+ {
+ base.OnItemsChanged(e);
+
+ UpdatePageButtons();
+ }
+
///
/// 是否自动跳转
///
@@ -109,19 +160,12 @@ namespace HandyControl.Controls
}
}
- public IEnumerable ItemsSource
- {
- get => (IEnumerable)GetValue(ItemsSourceProperty);
- set => SetValue(ItemsSourceProperty, value);
- }
-
- public ItemCollection Items => ListBoxMain.Items;
-
///
/// 计时器开关
///
private void TimerSwitch(bool run)
{
+ if (!_appliedTemplate) return;
if (run)
{
_updateTimer = new DispatcherTimer
@@ -133,9 +177,12 @@ namespace HandyControl.Controls
}
else
{
- _updateTimer.Tick -= UpdateTimer_Tick;
- _updateTimer.Stop();
- _updateTimer = null;
+ if (_updateTimer != null)
+ {
+ _updateTimer.Tick -= UpdateTimer_Tick;
+ _updateTimer.Stop();
+ _updateTimer = null;
+ }
}
}
@@ -150,34 +197,35 @@ namespace HandyControl.Controls
///
public void UpdatePageButtons(int? index = null)
{
+ if (!_appliedTemplate) return;
if (index == null)
{
var count = Items.Count;
_widthList.Clear();
_widthList.Add(0);
var width = .0;
- foreach (FrameworkElement item in ListBoxMain.Items)
+ foreach (FrameworkElement item in Items)
{
item.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
width += item.DesiredSize.Width;
_widthList.Add(width);
}
- ListBoxMain.Width = _widthList.Last() + ExtendWidth;
- PanelPage.Children.Clear();
+ _itemsControl.Width = _widthList.Last() + ExtendWidth;
+ _panelPage.Children.Clear();
for (var i = 0; i < count; i++)
- PanelPage.Children.Add(CreatePateButton());
+ _panelPage.Children.Add(CreatePateButton());
if (count > 0)
{
- var button = PanelPage.Children[0];
+ var button = _panelPage.Children[0];
button.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent, button));
}
}
else
{
- if (index >= 0 && index < PanelPage.Children.Count)
+ if (index >= 0 && index < _panelPage.Children.Count)
{
- var button = PanelPage.Children[(int)index];
+ var button = _panelPage.Children[(int)index];
button.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent, button));
UpdateItemsPosition();
}
@@ -189,17 +237,18 @@ namespace HandyControl.Controls
///
private void UpdateItemsPosition()
{
- if (Items.Count == 0 || PageIndex == -1) return;
+ if (!_appliedTemplate) return;
+ if (Items.Count == 0) return;
if (!IsCenter)
{
- ListBoxMain.BeginAnimation(MarginProperty,
+ _itemsControl.BeginAnimation(MarginProperty,
AnimationHelper.CreateAnimation(new Thickness(-_widthList[PageIndex], 0, 0, 0)));
}
else
{
var ctl = (FrameworkElement)Items[PageIndex];
var ctlWidth = ctl.DesiredSize.Width;
- ListBoxMain.BeginAnimation(MarginProperty,
+ _itemsControl.BeginAnimation(MarginProperty,
AnimationHelper.CreateAnimation(
new Thickness(-_widthList[PageIndex] + (ActualWidth - ctlWidth) / 2, 0, 0, 0)));
}
@@ -241,19 +290,13 @@ namespace HandyControl.Controls
_selectedButton = e.OriginalSource as Button;
if (_selectedButton != null && _selectedButton.Content is Border border)
border.Background = TryFindResource("PrimaryBrush") as Brush;
- var index = PanelPage.Children.IndexOf(_selectedButton);
+ var index = _panelPage.Children.IndexOf(_selectedButton);
if (index != -1)
PageIndex = index;
}
- private void ButtonPrev_OnClick(object sender, RoutedEventArgs e)
- {
- PageIndex--;
- }
+ private void ButtonPrev_OnClick(object sender, RoutedEventArgs e) => PageIndex--;
- private void ButtonNext_OnClick(object sender, RoutedEventArgs e)
- {
- PageIndex++;
- }
+ private void ButtonNext_OnClick(object sender, RoutedEventArgs e) => PageIndex++;
}
}
\ No newline at end of file
diff --git a/HandyControl/Controls/Carousel.xaml b/HandyControl/Controls/Carousel.xaml
deleted file mode 100644
index 85c612c8..00000000
--- a/HandyControl/Controls/Carousel.xaml
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/HandyControl/Controls/Growl.xaml.cs b/HandyControl/Controls/Growl.cs
similarity index 73%
rename from HandyControl/Controls/Growl.xaml.cs
rename to HandyControl/Controls/Growl.cs
index 31e3ac50..552f2b92 100644
--- a/HandyControl/Controls/Growl.xaml.cs
+++ b/HandyControl/Controls/Growl.cs
@@ -2,6 +2,7 @@
using System.Linq;
using System.Windows;
using System.Windows.Controls;
+using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Threading;
@@ -12,10 +13,66 @@ using HandyControl.Tools.Extension;
namespace HandyControl.Controls
{
///
- /// Growl.xaml 的交互逻辑
+ /// 消息提醒
///
- public partial class Growl
+ [TemplatePart(Name = ElementPanelMore, Type = typeof(Panel))]
+ [TemplatePart(Name = ElementGridMain, Type = typeof(Grid))]
+ [TemplatePart(Name = ElementButtonClose, Type = typeof(Button))]
+ public class Growl : Control
{
+ #region Constants
+
+ private const string ElementPanelMore = "PART_PanelMore";
+ private const string ElementGridMain = "PART_GridMain";
+ private const string ElementButtonClose = "PART_ButtonClose";
+
+ #endregion Constants
+
+ #region Data
+
+ private Panel _panelMore;
+
+ private Grid _gridMain;
+
+ private Button _buttonClose;
+
+ private bool _showCloseButton;
+
+ private bool _staysOpen;
+
+ #endregion Data
+
+ public Growl()
+ {
+ CommandBindings.Add(new CommandBinding(ControlCommands.Close, ButtonClose_OnClick));
+ CommandBindings.Add(new CommandBinding(ControlCommands.Cancel, ButtonCancel_OnClick));
+ CommandBindings.Add(new CommandBinding(ControlCommands.Confirm, ButtonOk_OnClick));
+
+ MouseEnter += Growl_MouseEnter;
+ MouseLeave += Growl_MouseLeave;
+ }
+
+ private void Growl_MouseLeave(object sender, MouseEventArgs e) => _buttonClose.Collapse();
+
+ private void Growl_MouseEnter(object sender, MouseEventArgs e) => _buttonClose.Show(_showCloseButton);
+
+ public override void OnApplyTemplate()
+ {
+ base.OnApplyTemplate();
+
+ _panelMore = GetTemplateChild(ElementPanelMore) as Panel;
+ _gridMain = GetTemplateChild(ElementGridMain) as Grid;
+ _buttonClose = GetTemplateChild(ElementButtonClose) as Button;
+
+ CheckNull();
+ Update();
+ }
+
+ private void CheckNull()
+ {
+ if (_panelMore == null || _gridMain == null || _buttonClose == null) throw new Exception();
+ }
+
///
/// 最大计数
///
@@ -48,8 +105,6 @@ namespace HandyControl.Controls
///
private DispatcherTimer _timerClose;
- public Growl() => InitializeComponent();
-
private Action CloseAction { get; set; }
public string Message
@@ -134,6 +189,25 @@ namespace HandyControl.Controls
collection.Add(behavior);
}
+ private void Update()
+ {
+ if (CloseAction != null)
+ {
+ _staysOpen = true;
+ _showCloseButton = false;
+ _panelMore.IsEnabled = true;
+ _panelMore.Show();
+ }
+
+ var transform = new TranslateTransform
+ {
+ X = MaxWidth
+ };
+ _gridMain.RenderTransform = transform;
+ transform.BeginAnimation(TranslateTransform.XProperty, AnimationHelper.CreateAnimation(0));
+ if (!_staysOpen) StartTimer();
+ }
+
///
/// 显示信息
///
@@ -145,27 +219,12 @@ namespace HandyControl.Controls
Message = message,
Time = DateTime.Now,
Icon = ResourceHelper.GetResource(iconKey),
- IconBrush = ResourceHelper.GetResource(iconBrushKey)
+ IconBrush = ResourceHelper.GetResource(iconBrushKey),
+ _showCloseButton = showCloseButton,
+ CloseAction = closeAction,
+ _staysOpen = staysOpen
};
- if (!showCloseButton) ctl.Triggers.Clear();
-
- if (closeAction != null)
- {
- staysOpen = true;
- ctl.Triggers.Clear();
- ctl.PanelMore.IsEnabled = true;
- ctl.PanelMore.Show();
- ctl.CloseAction = closeAction;
- }
-
- var transform = new TranslateTransform
- {
- X = ctl.MaxWidth
- };
- ctl.GridMain.RenderTransform = transform;
GrowlPanel.Children.Insert(0, ctl);
- transform.BeginAnimation(TranslateTransform.XProperty, AnimationHelper.CreateAnimation(0));
- if (!staysOpen) ctl.StartTimer();
}
///
@@ -213,7 +272,7 @@ namespace HandyControl.Controls
{
_timerClose?.Stop();
var transform = new TranslateTransform();
- GridMain.RenderTransform = transform;
+ _gridMain.RenderTransform = transform;
var animation = AnimationHelper.CreateAnimation(MaxWidth);
animation.Completed += delegate { GrowlPanel.Children.Remove(this); };
transform.BeginAnimation(TranslateTransform.XProperty, animation);
diff --git a/HandyControl/Controls/Growl.xaml b/HandyControl/Controls/Growl.xaml
deleted file mode 100644
index 6582e3e6..00000000
--- a/HandyControl/Controls/Growl.xaml
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/HandyControl/Controls/ScrollViewer.cs b/HandyControl/Controls/ScrollViewer.cs
index 129b6e72..2d9650d9 100644
--- a/HandyControl/Controls/ScrollViewer.cs
+++ b/HandyControl/Controls/ScrollViewer.cs
@@ -1,5 +1,6 @@
using System;
using System.Windows;
+using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
@@ -11,8 +12,40 @@ namespace HandyControl.Controls
{
private double _totalVerticalOffset;
+ private double _totalHorizontalOffset;
+
private bool _isRunning;
+ ///
+ /// 滚动方向
+ ///
+ public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register(
+ "Orientation", typeof(Orientation), typeof(ScrollViewer), new PropertyMetadata(Orientation.Vertical));
+
+ ///
+ /// 滚动方向
+ ///
+ public Orientation Orientation
+ {
+ get => (Orientation) GetValue(OrientationProperty);
+ set => SetValue(OrientationProperty, value);
+ }
+
+ ///
+ /// 是否响应鼠标滚轮操作
+ ///
+ public static readonly DependencyProperty CanMouseWheelProperty = DependencyProperty.Register(
+ "CanMouseWheel", typeof(bool), typeof(ScrollViewer), new PropertyMetadata(true));
+
+ ///
+ /// 是否响应鼠标滚轮操作
+ ///
+ public bool CanMouseWheel
+ {
+ get => (bool) GetValue(CanMouseWheelProperty);
+ set => SetValue(CanMouseWheelProperty, value);
+ }
+
protected override void OnMouseWheel(MouseWheelEventArgs e)
{
if (!IsEnableInertia)
@@ -22,27 +55,63 @@ namespace HandyControl.Controls
}
e.Handled = true;
- if (!_isRunning)
+ if (!CanMouseWheel) return;
+ if (Orientation == Orientation.Vertical)
{
- _totalVerticalOffset = VerticalOffset;
- CurrentVerticalOffset = VerticalOffset;
+ if (!_isRunning)
+ {
+ _totalVerticalOffset = VerticalOffset;
+ CurrentVerticalOffset = VerticalOffset;
+ }
+ _totalVerticalOffset = Math.Min(Math.Max(0, _totalVerticalOffset - e.Delta), ScrollableHeight);
+ ScrollToVerticalOffsetInternal(_totalVerticalOffset);
}
- _totalVerticalOffset = Math.Min(Math.Max(0, _totalVerticalOffset - e.Delta), ScrollableHeight);
- var animation = AnimationHelper.CreateAnimation(_totalVerticalOffset, 500);
+ else
+ {
+ if (!_isRunning)
+ {
+ _totalHorizontalOffset = HorizontalOffset;
+ CurrentHorizontalOffset = HorizontalOffset;
+ }
+ _totalHorizontalOffset = Math.Min(Math.Max(0, _totalHorizontalOffset - e.Delta), ScrollableWidth);
+ ScrollToHorizontalOffsetInternal(_totalHorizontalOffset);
+ }
+ }
+
+ internal void ScrollToVerticalOffsetInternal(double offset, double milliseconds = 500)
+ {
+ var animation = AnimationHelper.CreateAnimation(offset, milliseconds);
animation.EasingFunction = new CubicEase
{
EasingMode = EasingMode.EaseOut
};
animation.FillBehavior = FillBehavior.Stop;
- animation.Completed += (s,e1)=>
+ animation.Completed += (s, e1) =>
{
- CurrentVerticalOffset = _totalVerticalOffset;
+ CurrentVerticalOffset = offset;
_isRunning = false;
};
_isRunning = true;
BeginAnimation(CurrentVerticalOffsetProperty, animation);
}
+ internal void ScrollToHorizontalOffsetInternal(double offset, double milliseconds = 500)
+ {
+ var animation = AnimationHelper.CreateAnimation(offset, milliseconds);
+ animation.EasingFunction = new CubicEase
+ {
+ EasingMode = EasingMode.EaseOut
+ };
+ animation.FillBehavior = FillBehavior.Stop;
+ animation.Completed += (s, e1) =>
+ {
+ CurrentHorizontalOffset = offset;
+ _isRunning = false;
+ };
+ _isRunning = true;
+ BeginAnimation(CurrentHorizontalOffsetProperty, animation);
+ }
+
protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters) =>
IsPenetrating ? null : base.HitTestCore(hitTestParameters);
@@ -100,9 +169,9 @@ namespace HandyControl.Controls
/// 当前垂直滚动偏移
///
private static readonly DependencyProperty CurrentVerticalOffsetProperty = DependencyProperty.Register(
- "CurrentVerticalOffset", typeof(double), typeof(ScrollViewer), new PropertyMetadata(default(double), CurrentVerticalOffsetChangedCallback));
+ "CurrentVerticalOffset", typeof(double), typeof(ScrollViewer), new PropertyMetadata(default(double), OnCurrentVerticalOffsetChanged));
- private static void CurrentVerticalOffsetChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ private static void OnCurrentVerticalOffsetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is ScrollViewer ctl && e.NewValue is double v)
{
@@ -119,5 +188,29 @@ namespace HandyControl.Controls
get => (double) GetValue(CurrentVerticalOffsetProperty);
set => SetValue(CurrentVerticalOffsetProperty, value);
}
+
+ ///
+ /// 当前水平滚动偏移
+ ///
+ public static readonly DependencyProperty CurrentHorizontalOffsetProperty = DependencyProperty.Register(
+ "CurrentHorizontalOffset", typeof(double), typeof(ScrollViewer), new PropertyMetadata(default(double), OnCurrentHorizontalOffsetChanged));
+
+ private static void OnCurrentHorizontalOffsetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ if (d is ScrollViewer ctl && e.NewValue is double v)
+ {
+ ctl.ScrollToHorizontalOffset(v);
+ Console.WriteLine(v);
+ }
+ }
+
+ ///
+ /// 当前水平滚动偏移
+ ///
+ public double CurrentHorizontalOffset
+ {
+ get => (double) GetValue(CurrentHorizontalOffsetProperty);
+ set => SetValue(CurrentHorizontalOffsetProperty, value);
+ }
}
}
\ No newline at end of file
diff --git a/HandyControl/Controls/Steps/StepBar.xaml.cs b/HandyControl/Controls/Steps/StepBar.cs
similarity index 51%
rename from HandyControl/Controls/Steps/StepBar.xaml.cs
rename to HandyControl/Controls/Steps/StepBar.cs
index 62e5901a..45506a98 100644
--- a/HandyControl/Controls/Steps/StepBar.xaml.cs
+++ b/HandyControl/Controls/Steps/StepBar.cs
@@ -1,5 +1,8 @@
-using System.Collections.Generic;
+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;
@@ -11,17 +14,28 @@ using HandyControl.Tools;
namespace HandyControl.Controls
{
///
- /// Steps.xaml 的交互逻辑
+ /// 步骤条
///
[ContentProperty("Items")]
- public partial class StepBar
+ [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 StepBar()
{
- InitializeComponent();
-
Loaded += (s1, e1) =>
{
if (_isLoaded) return;
@@ -34,6 +48,21 @@ namespace HandyControl.Controls
};
}
+ public override void OnApplyTemplate()
+ {
+ base.OnApplyTemplate();
+
+ _progressBarBack = GetTemplateChild(ElementProgressBarBack) as ProgressBar;
+ _panelMain = GetTemplateChild(ElementUniformGridMain) as Panel;
+
+ CheckNull();
+ }
+
+ private void CheckNull()
+ {
+ if (_panelMain == null || _progressBarBack == null) throw new Exception();
+ }
+
public int StepIndex { get; private set; }
public List Items { get; set; } = new List();
@@ -41,14 +70,14 @@ namespace HandyControl.Controls
private void UpdateItems(IReadOnlyCollection list)
{
if (list == null) return;
- UniformGridMain.Children.Clear();
+ _panelMain.Children.Clear();
var index = 1;
foreach (var item in list)
{
item.Index = index;
item.IndexStr = $"{Properties.Langs.Lang.Step}{index}";
- UniformGridMain.Children.Add(item);
+ _panelMain.Children.Add(item);
index++;
}
@@ -62,26 +91,26 @@ namespace HandyControl.Controls
{
base.OnRender(drawingContext);
- var colCount = UniformGridMain.Children.Count;
+ var colCount = _panelMain.Children.Count;
if (colCount <= 0) return;
- ProgressBarBack.Width = (colCount - 1) * (ActualWidth / colCount);
- ProgressBarBack.Value = 0;
- ProgressBarBack.Maximum = colCount - 1;
+ _progressBarBack.Width = (colCount - 1) * (ActualWidth / colCount);
+ _progressBarBack.Value = 0;
+ _progressBarBack.Maximum = colCount - 1;
}
public void Next()
{
StepIndex++;
- if (StepIndex >= UniformGridMain.Children.Count)
+ if (StepIndex >= _panelMain.Children.Count)
{
- StepIndex = UniformGridMain.Children.Count - 1;
+ StepIndex = _panelMain.Children.Count - 1;
return;
}
- if (UniformGridMain.Children[StepIndex - 1] is StepItem stepItemFinished)
+ if (_panelMain.Children[StepIndex - 1] is StepItem stepItemFinished)
stepItemFinished.Status = true;
- if (UniformGridMain.Children[StepIndex] is StepItem stepItemSelected)
+ if (_panelMain.Children[StepIndex] is StepItem stepItemSelected)
stepItemSelected.Status = false;
- ProgressBarBack.BeginAnimation(RangeBase.ValueProperty, AnimationHelper.CreateAnimation(StepIndex));
+ _progressBarBack.BeginAnimation(RangeBase.ValueProperty, AnimationHelper.CreateAnimation(StepIndex));
}
public void Prev()
@@ -92,11 +121,11 @@ namespace HandyControl.Controls
StepIndex = 0;
return;
}
- if (UniformGridMain.Children[StepIndex + 1] is StepItem stepItemFinished)
+ if (_panelMain.Children[StepIndex + 1] is StepItem stepItemFinished)
stepItemFinished.Status = null;
- if (UniformGridMain.Children[StepIndex] is StepItem stepItemSelected)
+ if (_panelMain.Children[StepIndex] is StepItem stepItemSelected)
stepItemSelected.Status = false;
- ProgressBarBack.BeginAnimation(RangeBase.ValueProperty, AnimationHelper.CreateAnimation(StepIndex));
+ _progressBarBack.BeginAnimation(RangeBase.ValueProperty, AnimationHelper.CreateAnimation(StepIndex));
}
}
}
\ No newline at end of file
diff --git a/HandyControl/Controls/Steps/StepBar.xaml b/HandyControl/Controls/Steps/StepBar.xaml
deleted file mode 100644
index dd225d16..00000000
--- a/HandyControl/Controls/Steps/StepBar.xaml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/HandyControl/Controls/Steps/StepItem.xaml.cs b/HandyControl/Controls/Steps/StepItem.cs
similarity index 78%
rename from HandyControl/Controls/Steps/StepItem.xaml.cs
rename to HandyControl/Controls/Steps/StepItem.cs
index 1b0183df..37fc286a 100644
--- a/HandyControl/Controls/Steps/StepItem.xaml.cs
+++ b/HandyControl/Controls/Steps/StepItem.cs
@@ -1,19 +1,16 @@
using System.Windows;
+using System.Windows.Controls;
using System.Windows.Media;
+using HandyControl.Tools;
// ReSharper disable once CheckNamespace
namespace HandyControl.Controls
{
///
- /// StepItem.xaml 的交互逻辑
+ /// 步骤条单元项
///
- public partial class StepItem
+ public class StepItem : Control
{
- public StepItem()
- {
- InitializeComponent();
- }
-
internal static readonly DependencyProperty IndexProperty = DependencyProperty.Register(
"Index", typeof(int), typeof(StepItem), new PropertyMetadata(-1));
@@ -28,7 +25,7 @@ namespace HandyControl.Controls
internal string IndexStr
{
- get => (string) GetValue(IndexStrProperty);
+ get => (string)GetValue(IndexStrProperty);
set => SetValue(IndexStrProperty, value);
}
@@ -57,15 +54,15 @@ namespace HandyControl.Controls
{
if (Status == true)
{
- Foreground = TryFindResource("PrimaryTextBrush") as Brush;
+ Foreground = ResourceHelper.GetResource("PrimaryTextBrush");
}
else if (Status == false)
{
- Foreground = TryFindResource("PrimaryBrush") as Brush;
+ Foreground = ResourceHelper.GetResource("PrimaryBrush");
}
else
{
- Foreground = TryFindResource("ThirdlyTextBrush") as Brush;
+ Foreground = ResourceHelper.GetResource("ThirdlyTextBrush");
}
}
}
diff --git a/HandyControl/Controls/Steps/StepItem.xaml b/HandyControl/Controls/Steps/StepItem.xaml
deleted file mode 100644
index cd153e3f..00000000
--- a/HandyControl/Controls/Steps/StepItem.xaml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/HandyControl/Controls/TimeBar/TimeBar.xaml.cs b/HandyControl/Controls/TimeBar/TimeBar.cs
similarity index 73%
rename from HandyControl/Controls/TimeBar/TimeBar.xaml.cs
rename to HandyControl/Controls/TimeBar/TimeBar.cs
index e2e85379..6541c40b 100644
--- a/HandyControl/Controls/TimeBar/TimeBar.xaml.cs
+++ b/HandyControl/Controls/TimeBar/TimeBar.cs
@@ -1,41 +1,90 @@
using System;
using System.Collections.Generic;
using System.Windows;
+using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using HandyControl.Data;
+using HandyControl.Interactivity;
+using HandyControl.Tools;
// ReSharper disable once CheckNamespace
namespace HandyControl.Controls
{
///
- /// TimeBar.xaml 的交互逻辑
+ /// 时间条
///
- public partial class TimeBar
+ [TemplatePart(Name = ElementBorderTop, Type = typeof(Border))]
+ [TemplatePart(Name = ElementTextBlockMove, Type = typeof(TextBlock))]
+ [TemplatePart(Name = ElementTextBlockSelected, Type = typeof(TextBlock))]
+ [TemplatePart(Name = ElementCanvasSpe, Type = typeof(Canvas))]
+ public class TimeBar : Control
{
+ #region Constants
+
+ private const string ElementBorderTop = "PART_BorderTop";
+
+ private const string ElementTextBlockMove = "PART_TextBlockMove";
+
+ private const string ElementTextBlockSelected = "PART_TextBlockSelected";
+
+ private const string ElementCanvasSpe = "PART_CanvasSpe";
+
+ #endregion Constants
+
+
+ #region Data
+
+ private Border _borderTop;
+
+ private TextBlock _textBlockMove;
+
+ private TextBlock _textBlockSelected;
+
+ private Canvas _canvasSpe;
+
+ #endregion Data
+
///
/// 是否显示刻度字符串
///
public static readonly DependencyProperty ShowSpeStrProperty = DependencyProperty.Register(
"ShowSpeStr", typeof(bool), typeof(TimeBar), new PropertyMetadata(default(bool)));
+ public static readonly DependencyProperty TimeFormatProperty = DependencyProperty.Register(
+ "TimeFormat", typeof(string), typeof(TimeBar), new PropertyMetadata("yyyy-MM-dd HH:mm:ss"));
+
+ public string TimeFormat
+ {
+ get => (string) GetValue(TimeFormatProperty);
+ set => SetValue(TimeFormatProperty, value);
+ }
+
///
/// 刻度字符串
///
- private static readonly DependencyProperty SpeStrProperty = DependencyProperty.Register(
+ internal static readonly DependencyProperty SpeStrProperty = DependencyProperty.Register(
"SpeStr", typeof(string), typeof(TimeBar), new PropertyMetadata(Properties.Langs.Lang.Interval1h));
///
/// 选中时间
///
- private static readonly DependencyProperty SelectedTimeProperty = DependencyProperty.Register(
- "SelectedTime", typeof(DateTime), typeof(TimeBar));
+ internal static readonly DependencyProperty SelectedTimeProperty = DependencyProperty.Register(
+ "SelectedTime", typeof(DateTime), typeof(TimeBar), new PropertyMetadata(default(DateTime), OnSelectedTimeChanged));
+
+ private static void OnSelectedTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ if (d is TimeBar timeBar && timeBar._textBlockSelected != null)
+ {
+ timeBar._textBlockSelected.Text = ((DateTime) e.NewValue).ToString(timeBar.TimeFormat);
+ }
+ }
///
/// 时间改变事件
///
public static readonly RoutedEvent TimeChangedEvent =
- EventManager.RegisterRoutedEvent("ButtonCloseClick", RoutingStrategy.Bubble,
+ EventManager.RegisterRoutedEvent("TimeChanged", RoutingStrategy.Bubble,
typeof(EventHandler>), typeof(TimeBar));
///
@@ -104,11 +153,48 @@ namespace HandyControl.Controls
public TimeBar()
{
- InitializeComponent();
-
_starTime = DateTime.Now;
SelectedTime = new DateTime(_starTime.Year, _starTime.Month, _starTime.Day, 0, 0, 0);
_starTime = SelectedTime;
+
+ SizeChanged += TimeBar_OnSizeChanged;
+ MouseMove += TimeBar_OnMouseMove;
+ }
+
+ public override void OnApplyTemplate()
+ {
+ if (_borderTop != null)
+ {
+ _borderTop.MouseLeftButtonDown -= BorderTop_OnMouseLeftButtonDown;
+ _borderTop.PreviewMouseLeftButtonUp -= BorderTop_OnPreviewMouseLeftButtonUp;
+ }
+
+ base.OnApplyTemplate();
+
+ _borderTop = GetTemplateChild(ElementBorderTop) as Border;
+ _textBlockMove = GetTemplateChild(ElementTextBlockMove) as TextBlock;
+ _textBlockSelected = GetTemplateChild(ElementTextBlockSelected) as TextBlock;
+ _canvasSpe = GetTemplateChild(ElementCanvasSpe) as Canvas;
+
+ CheckNull();
+ _borderTop.MouseLeftButtonDown += BorderTop_OnMouseLeftButtonDown;
+ _borderTop.PreviewMouseLeftButtonUp += BorderTop_OnPreviewMouseLeftButtonUp;
+ var behavior = new MouseDragElementBehaviorEx
+ {
+ LockY = true,
+ };
+ behavior.DragBegun += DragElementBehavior_OnDragBegun;
+ behavior.Dragging += MouseDragElementBehavior_OnDragging;
+ behavior.DragFinished += MouseDragElementBehavior_OnDragFinished;
+ var collection = Interaction.GetBehaviors(_borderTop);
+ collection.Add(behavior);
+
+ _textBlockSelected.Text = SelectedTime.ToString(TimeFormat);
+ }
+
+ private void CheckNull()
+ {
+ if (_borderTop == null || _textBlockMove == null|| _textBlockSelected == null || _canvasSpe == null) throw new Exception();
}
///
@@ -123,7 +209,7 @@ namespace HandyControl.Controls
///
/// 刻度字符串
///
- private string SpeStr
+ internal string SpeStr
{
get => (string)GetValue(SpeStrProperty);
set => SetValue(SpeStrProperty, value);
@@ -132,7 +218,7 @@ namespace HandyControl.Controls
///
/// 选中时间
///
- private DateTime SelectedTime
+ internal DateTime SelectedTime
{
get => (DateTime)GetValue(SelectedTimeProperty);
set => SetValue(SelectedTimeProperty, value);
@@ -286,7 +372,7 @@ namespace HandyControl.Controls
private void MouseDragElementBehavior_OnDragging(object sender, MouseEventArgs e)
{
_isDragging = true;
- _tempOffsetX = BorderTop.RenderTransform.Value.OffsetX;
+ _tempOffsetX = _borderTop.RenderTransform.Value.OffsetX;
SelectedTime = _mouseDownTime -
TimeSpan.FromMilliseconds(_tempOffsetX / _itemWidth * _timeSpeList[_speIndex]);
@@ -297,8 +383,8 @@ namespace HandyControl.Controls
private void MouseDragElementBehavior_OnDragFinished(object sender, MouseEventArgs e)
{
_tempOffsetX = 0;
- _totalOffsetX = (_totalOffsetX + BorderTop.RenderTransform.Value.OffsetX) % ActualWidth;
- BorderTop.RenderTransform = new TranslateTransform();
+ _totalOffsetX = (_totalOffsetX + _borderTop.RenderTransform.Value.OffsetX) % ActualWidth;
+ _borderTop.RenderTransform = new TranslateTransform();
RaiseEvent(new FunctionEventArgs(TimeChangedEvent, this)
{
Info = SelectedTime
@@ -306,15 +392,12 @@ namespace HandyControl.Controls
_isDragging = false;
}
- private void DragElementBehavior_OnDragBegun(object sender, MouseEventArgs e)
- {
- _mouseDownTime = SelectedTime;
- }
+ private void DragElementBehavior_OnDragBegun(object sender, MouseEventArgs e) => _mouseDownTime = SelectedTime;
private void TimeBar_OnSizeChanged(object sender, SizeChangedEventArgs e)
{
_speBlockList.Clear();
- CanvasSpe.Children.Clear();
+ _canvasSpe.Children.Clear();
_speCount = (int)(ActualWidth / 800 * 9) | 1;
@@ -335,7 +418,7 @@ namespace HandyControl.Controls
TimeFormat = "HH:mm"
};
_speBlockList.Add(block);
- CanvasSpe.Children.Add(block);
+ _canvasSpe.Children.Add(block);
}
if (_speIndex == 6)
SetSpeTimeFormat("HH:mm:ss");
@@ -356,16 +439,13 @@ namespace HandyControl.Controls
var p = Mouse.GetPosition(this);
var mlliseconds = (p.X - ActualWidth / 2) / _itemWidth * _timeSpeList[_speIndex];
if (double.IsInfinity(mlliseconds)) return;
- TextBlockSelected.Text = mlliseconds < 0
- ? (SelectedTime - TimeSpan.FromMilliseconds(-mlliseconds)).ToString("yyyy-MM-dd HH:mm:ss")
- : (SelectedTime + TimeSpan.FromMilliseconds(mlliseconds)).ToString("yyyy-MM-dd HH:mm:ss");
- TextBlockSelected.Margin = new Thickness(p.X - TextBlockSelected.ActualWidth / 2, 2, 0, 0);
+ _textBlockMove.Text = mlliseconds < 0
+ ? (SelectedTime - TimeSpan.FromMilliseconds(-mlliseconds)).ToString(TimeFormat)
+ : (SelectedTime + TimeSpan.FromMilliseconds(mlliseconds)).ToString(TimeFormat);
+ _textBlockMove.Margin = new Thickness(p.X - _textBlockMove.ActualWidth / 2, 2, 0, 0);
}
- private void BorderTop_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
- _borderTopIsMouseLeftButtonDown = true;
- }
+ private void BorderTop_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) => _borderTopIsMouseLeftButtonDown = true;
private void BorderTop_OnPreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
diff --git a/HandyControl/Controls/TimeBar/TimeBar.xaml b/HandyControl/Controls/TimeBar/TimeBar.xaml
deleted file mode 100644
index 2073a1f0..00000000
--- a/HandyControl/Controls/TimeBar/TimeBar.xaml
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/HandyControl/Controls/Window/PopupWindow.xaml.cs b/HandyControl/Controls/Window/PopupWindow.cs
similarity index 54%
rename from HandyControl/Controls/Window/PopupWindow.xaml.cs
rename to HandyControl/Controls/Window/PopupWindow.cs
index baf4a9e3..7270b443 100644
--- a/HandyControl/Controls/Window/PopupWindow.xaml.cs
+++ b/HandyControl/Controls/Window/PopupWindow.cs
@@ -1,7 +1,9 @@
using System;
using System.Windows;
+using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
+using HandyControl.Interactivity;
using HandyControl.Tools;
// ReSharper disable once CheckNamespace
@@ -10,18 +12,62 @@ namespace HandyControl.Controls
///
/// 弹出窗口
///
- public partial class PopupWindow
+ [TemplatePart(Name = ElementMainBorder, Type = typeof(Border))]
+ [TemplatePart(Name = ElementTitleBlock, Type = typeof(TextBlock))]
+ public class PopupWindow : Window
{
+ #region Constants
+
+ private const string ElementMainBorder = "PART_MainBorder";
+
+ private const string ElementTitleBlock = "PART_TitleBlock";
+
+ #endregion Constants
+
+ private Border _mainBorder;
+
+ private TextBlock _titleBlock;
+
+ public override void OnApplyTemplate()
+ {
+ if (_titleBlock != null)
+ {
+ _titleBlock.MouseLeftButtonDown -= TitleBlock_OnMouseLeftButtonDown;
+ }
+
+ base.OnApplyTemplate();
+
+ _mainBorder = GetTemplateChild(ElementMainBorder) as Border;
+ _titleBlock = GetTemplateChild(ElementTitleBlock) as TextBlock;
+
+ if (_titleBlock != null)
+ {
+ _titleBlock.MouseLeftButtonDown += TitleBlock_OnMouseLeftButtonDown;
+ }
+ }
+
+ internal static readonly DependencyProperty ContentStrProperty = DependencyProperty.Register(
+ "ContentStr", typeof(string), typeof(PopupWindow), new PropertyMetadata(default(string)));
+
+ internal string ContentStr
+ {
+ get => (string) GetValue(ContentStrProperty);
+ set => SetValue(ContentStrProperty, value);
+ }
+
private bool IsDialog { get; set; }
public PopupWindow()
{
+ CommandBindings.Add(new CommandBinding(ControlCommands.Close, CloseButton_OnClick));
+ CommandBindings.Add(new CommandBinding(ControlCommands.Confirm, ButtonOk_OnClick));
+ CommandBindings.Add(new CommandBinding(ControlCommands.Cancel, ButtonCancle_OnClick));
+
Closing += (sender, args) =>
{
if (!IsDialog)
Owner?.Focus();
};
- InitializeComponent();
try
{
Owner = Application.Current.MainWindow;
@@ -32,57 +78,55 @@ namespace HandyControl.Controls
}
}
- public PopupWindow(Window owner) : this()
- {
- Owner = owner;
- }
+ public PopupWindow(Window owner) : this() => Owner = owner;
- private void CloseButton_OnClick(object sender, RoutedEventArgs e)
- {
- Close();
- }
+ private void CloseButton_OnClick(object sender, RoutedEventArgs e) => Close();
public UIElement Child
{
- get => MainBorder.Child;
- set => MainBorder.Child = value;
- }
-
- public bool ShowTitle
- {
+ get => _mainBorder?.Child;
set
{
- if (!value)
+ if (_mainBorder != null)
{
- TitleGrid.Visibility = Visibility.Collapsed;
- Background = Brushes.Transparent;
- }
- else
- {
- TitleGrid.Visibility = Visibility.Visible;
- Background = new SolidColorBrush(Color.FromRgb(1, 1, 1));
+ _mainBorder.Child = value;
}
}
}
+ public static readonly DependencyProperty ShowTitleProperty = DependencyProperty.Register(
+ "ShowTitle", typeof(bool), typeof(PopupWindow), new PropertyMetadata(true));
+
+ public bool ShowTitle
+ {
+ get => (bool) GetValue(ShowTitleProperty);
+ set => SetValue(ShowTitleProperty, value);
+ }
+
public static readonly DependencyProperty ShowCancelProperty = DependencyProperty.Register(
"ShowCancel", typeof(bool), typeof(PopupWindow), new PropertyMetadata(default(bool)));
-
public bool ShowCancel
{
get => (bool)GetValue(ShowCancelProperty);
set => SetValue(ShowCancelProperty, value);
}
+ public static readonly DependencyProperty ShowBorderProperty = DependencyProperty.Register(
+ "ShowBorder", typeof(bool), typeof(PopupWindow), new PropertyMetadata(default(bool)));
+
public bool ShowBorder
{
- set => MainBorder.BorderThickness = value ? new Thickness(1, 0, 1, 1) : new Thickness(0);
+ get => (bool) GetValue(ShowBorderProperty);
+ set => SetValue(ShowBorderProperty, value);
}
private void TitleBlock_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
- DragMove();
+ if (e.LeftButton == MouseButtonState.Pressed)
+ {
+ DragMove();
+ }
}
public void Show(FrameworkElement element)
@@ -113,25 +157,25 @@ namespace HandyControl.Controls
var window = new PopupWindow
{
AllowsTransparency = true,
- MyStackPanel = { Visibility = Visibility.Visible },
- MyTextBlock = { Text = message },
+ WindowStyle = WindowStyle.None,
+ ContentStr = message,
WindowStartupLocation = WindowStartupLocation.CenterScreen,
};
window.Background = window.FindResource("PrimaryBrush") as SolidColorBrush;
window.Show();
}
- public static bool? ShowDialog(string message, string title = "提示", bool showCancel = false)
+ public static bool? ShowDialog(string message, string title = default(string), bool showCancel = false)
{
var window = new PopupWindow
{
AllowsTransparency = true,
- MyStackPanel = { Visibility = Visibility.Visible },
- MyTextBlock = { Text = message },
+ WindowStyle = WindowStyle.None,
+ ContentStr = message,
IsDialog = true,
WindowStartupLocation = WindowStartupLocation.CenterScreen,
ShowBorder = true,
- Title = title,
+ Title = string.IsNullOrEmpty(title) ? Properties.Langs.Lang.Tip : title,
ShowCancel = showCancel
};
return window.ShowDialog();
@@ -161,4 +205,4 @@ namespace HandyControl.Controls
Child = null;
}
}
-}
+}
\ No newline at end of file
diff --git a/HandyControl/Controls/Window/PopupWindow.xaml b/HandyControl/Controls/Window/PopupWindow.xaml
deleted file mode 100644
index fb7a0228..00000000
--- a/HandyControl/Controls/Window/PopupWindow.xaml
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/HandyControl/HandyControl.csproj b/HandyControl/HandyControl.csproj
index a5d7af25..8e2d91c0 100644
--- a/HandyControl/HandyControl.csproj
+++ b/HandyControl/HandyControl.csproj
@@ -42,21 +42,17 @@
-
- Carousel.xaml
-
+
+
ColorPicker.xaml
-
- Growl.xaml
-
@@ -68,28 +64,20 @@
-
- StepBar.xaml
-
-
- StepItem.xaml
-
+
+
-
- TimeBar.xaml
-
+
ImageBrowser.xaml
-
- PopupWindow.xaml
-
+
@@ -169,18 +157,10 @@
-
- Designer
- MSBuild:Compile
-
Designer
MSBuild:Compile
-
- Designer
- MSBuild:Compile
-
Designer
MSBuild:Compile
@@ -189,26 +169,10 @@
Designer
MSBuild:Compile
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
Designer
MSBuild:Compile
-
- Designer
- MSBuild:Compile
-
Designer
MSBuild:Compile
@@ -329,10 +293,18 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -353,6 +325,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -381,6 +357,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -397,6 +377,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -405,6 +389,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/HandyControl/Interactivity/ControlCommands.cs b/HandyControl/Interactivity/ControlCommands.cs
index c65e3e05..2bb1b1cc 100644
--- a/HandyControl/Interactivity/ControlCommands.cs
+++ b/HandyControl/Interactivity/ControlCommands.cs
@@ -17,6 +17,16 @@ namespace HandyControl.Interactivity
///
public static RoutedCommand Close { get; } = new RoutedCommand("Close", typeof(ControlCommands));
+ ///
+ /// 取消
+ ///
+ public static RoutedCommand Cancel { get; } = new RoutedCommand("Cancel", typeof(ControlCommands));
+
+ ///
+ /// 确定
+ ///
+ public static RoutedCommand Confirm { get; } = new RoutedCommand("Confirm", typeof(ControlCommands));
+
///
/// 关闭所有
///
diff --git a/HandyControl/Properties/AssemblyInfo.cs b/HandyControl/Properties/AssemblyInfo.cs
index d90f6964..59ab3326 100644
--- a/HandyControl/Properties/AssemblyInfo.cs
+++ b/HandyControl/Properties/AssemblyInfo.cs
@@ -10,5 +10,5 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
-[assembly: AssemblyVersion("1.3.2.1")]
-[assembly: AssemblyFileVersion("1.3.2.1")]
+[assembly: AssemblyVersion("1.3.2.2")]
+[assembly: AssemblyFileVersion("1.3.2.2")]
diff --git a/HandyControl/Properties/Langs/Lang.Designer.cs b/HandyControl/Properties/Langs/Lang.Designer.cs
index 1426b182..e92c76d4 100644
--- a/HandyControl/Properties/Langs/Lang.Designer.cs
+++ b/HandyControl/Properties/Langs/Lang.Designer.cs
@@ -231,6 +231,15 @@ namespace HandyControl.Properties.Langs {
}
}
+ ///
+ /// 查找类似 提示 的本地化字符串。
+ ///
+ public static string Tip {
+ get {
+ return ResourceManager.GetString("Tip", resourceCulture);
+ }
+ }
+
///
/// 查找类似 过大 的本地化字符串。
///
diff --git a/HandyControl/Properties/Langs/Lang.en.resx b/HandyControl/Properties/Langs/Lang.en.resx
index dea3c047..c0119e2f 100644
--- a/HandyControl/Properties/Langs/Lang.en.resx
+++ b/HandyControl/Properties/Langs/Lang.en.resx
@@ -183,4 +183,7 @@
Pm
+
+ Prompt
+
\ No newline at end of file
diff --git a/HandyControl/Properties/Langs/Lang.resx b/HandyControl/Properties/Langs/Lang.resx
index 0cde7200..1a5a3aa0 100644
--- a/HandyControl/Properties/Langs/Lang.resx
+++ b/HandyControl/Properties/Langs/Lang.resx
@@ -163,4 +163,7 @@
下午
+
+ 提示
+
\ No newline at end of file
diff --git a/HandyControl/Themes/Basic/Brushes.xaml b/HandyControl/Themes/Basic/Brushes.xaml
index ba5b95ca..de9e53ff 100644
--- a/HandyControl/Themes/Basic/Brushes.xaml
+++ b/HandyControl/Themes/Basic/Brushes.xaml
@@ -47,4 +47,6 @@
+
+
\ No newline at end of file
diff --git a/HandyControl/Themes/Basic/Colors.xaml b/HandyControl/Themes/Basic/Colors.xaml
index ca9c56e5..9693f28a 100644
--- a/HandyControl/Themes/Basic/Colors.xaml
+++ b/HandyControl/Themes/Basic/Colors.xaml
@@ -32,4 +32,5 @@
#d43f3a
#20000000
+ #40000000
\ No newline at end of file
diff --git a/HandyControl/Themes/Styles/Carousel.xaml b/HandyControl/Themes/Styles/Carousel.xaml
new file mode 100644
index 00000000..2443404e
--- /dev/null
+++ b/HandyControl/Themes/Styles/Carousel.xaml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HandyControl/Themes/Styles/ColorPicker.xaml b/HandyControl/Themes/Styles/ColorPicker.xaml
new file mode 100644
index 00000000..825650eb
--- /dev/null
+++ b/HandyControl/Themes/Styles/ColorPicker.xaml
@@ -0,0 +1,4 @@
+
+
+
\ No newline at end of file
diff --git a/HandyControl/Themes/Styles/Growl.xaml b/HandyControl/Themes/Styles/Growl.xaml
new file mode 100644
index 00000000..fd5a3070
--- /dev/null
+++ b/HandyControl/Themes/Styles/Growl.xaml
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HandyControl/Themes/Styles/ListBox.xaml b/HandyControl/Themes/Styles/ListBox.xaml
index a39a616e..10f371e4 100644
--- a/HandyControl/Themes/Styles/ListBox.xaml
+++ b/HandyControl/Themes/Styles/ListBox.xaml
@@ -42,7 +42,7 @@
-
+
+
+
+
+
\ No newline at end of file
diff --git a/HandyControl/Themes/Styles/Style.xaml b/HandyControl/Themes/Styles/Style.xaml
index 46349e53..73207510 100644
--- a/HandyControl/Themes/Styles/Style.xaml
+++ b/HandyControl/Themes/Styles/Style.xaml
@@ -25,6 +25,12 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HandyControl/Themes/Styles/TimeBar.xaml b/HandyControl/Themes/Styles/TimeBar.xaml
new file mode 100644
index 00000000..475ba5a8
--- /dev/null
+++ b/HandyControl/Themes/Styles/TimeBar.xaml
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HandyControl/Themes/Styles/TransitioningContentControl.xaml b/HandyControl/Themes/Styles/TransitioningContentControl.xaml
new file mode 100644
index 00000000..15cbee50
--- /dev/null
+++ b/HandyControl/Themes/Styles/TransitioningContentControl.xaml
@@ -0,0 +1,107 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/HandyControl/Themes/Styles/Window.xaml b/HandyControl/Themes/Styles/Window.xaml
index ffbabdba..8e55c62c 100644
--- a/HandyControl/Themes/Styles/Window.xaml
+++ b/HandyControl/Themes/Styles/Window.xaml
@@ -1,12 +1,14 @@
+ xmlns:controls="clr-namespace:HandyControl.Controls"
+ xmlns:langs="clr-namespace:HandyControl.Properties.Langs"
+ xmlns:interactivity="clr-namespace:HandyControl.Interactivity">
-
+
-
\ No newline at end of file
diff --git a/HandyControlDemo/Properties/AssemblyInfo.cs b/HandyControlDemo/Properties/AssemblyInfo.cs
index b61d582b..1e33adb5 100644
--- a/HandyControlDemo/Properties/AssemblyInfo.cs
+++ b/HandyControlDemo/Properties/AssemblyInfo.cs
@@ -12,5 +12,5 @@ using System.Windows;
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
-[assembly: AssemblyVersion("1.3.2.1")]
-[assembly: AssemblyFileVersion("1.3.2.1")]
+[assembly: AssemblyVersion("1.3.2.2")]
+[assembly: AssemblyFileVersion("1.3.2.2")]
diff --git a/HandyControlDemo/UserControl/Controls/CarouselDemoCtl.xaml b/HandyControlDemo/UserControl/Controls/CarouselDemoCtl.xaml
index 2de728da..bdb6e863 100644
--- a/HandyControlDemo/UserControl/Controls/CarouselDemoCtl.xaml
+++ b/HandyControlDemo/UserControl/Controls/CarouselDemoCtl.xaml
@@ -4,7 +4,7 @@
Background="White"
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl">
-
+
diff --git a/HandyControlDemo/UserControl/Controls/StepBarDemoCtl.xaml b/HandyControlDemo/UserControl/Controls/StepBarDemoCtl.xaml
index fb03c3be..f9b94f21 100644
--- a/HandyControlDemo/UserControl/Controls/StepBarDemoCtl.xaml
+++ b/HandyControlDemo/UserControl/Controls/StepBarDemoCtl.xaml
@@ -7,7 +7,7 @@
FocusManager.FocusedElement="{Binding RelativeSource={x:Static RelativeSource.Self}, Mode=OneTime}"
Background="White">
-
+