From ab4cbba2be1e3b3f3966988fb56b8990d19a7554 Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Tue, 18 Aug 2020 00:05:30 +0800 Subject: [PATCH] add RangeSlider,ProgressButton and RangeSlider docs --- README-cn.md | 4 ++ README.md | 4 ++ .../extend_controls/previewSlider/index.md | 41 +++++++++++- .../extend_controls/progressButton/index.md | 30 ++++++++- .../extend_controls/rangeSlider/index.md | 63 ++++++++++++++++++- .../Slider/RangeSlider/RangeSlider.cs | 19 +++--- 6 files changed, 145 insertions(+), 16 deletions(-) diff --git a/README-cn.md b/README-cn.md index d6f64dd5..200f12ab 100644 --- a/README-cn.md +++ b/README-cn.md @@ -311,6 +311,10 @@ Step 4: Enjoy coding ![Slider](https://gitee.com/handyorg/HandyOrgResource/raw/master/HandyControl/Resources/Slider.png) +### RangeSlider + +![RangeSlider](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/RangeSlider.png) + ### CircleProgressBar ![CircleProgressBar](https://gitee.com/handyorg/HandyOrgResource/raw/master/HandyControl/Resources/CircleProgressBar.png) diff --git a/README.md b/README.md index 840531a6..1e950e5b 100644 --- a/README.md +++ b/README.md @@ -311,6 +311,10 @@ Step 4: Enjoy coding ![Slider](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/Slider.png) +### RangeSlider + +![RangeSlider](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/RangeSlider.png) + ### CircleProgressBar ![CircleProgressBar](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/CircleProgressBar.png) diff --git a/doc/source/handycontrol/extend_controls/previewSlider/index.md b/doc/source/handycontrol/extend_controls/previewSlider/index.md index ca12ad62..504ce54d 100644 --- a/doc/source/handycontrol/extend_controls/previewSlider/index.md +++ b/doc/source/handycontrol/extend_controls/previewSlider/index.md @@ -1,5 +1,42 @@ --- -title: 建设中 +title: PreviewSlider 预览滑块 --- -建设中 \ No newline at end of file +可借助预览滑块向用户反馈在不同位置的状态信息. + +```cs +[TemplatePart(Name = TrackKey, Type = typeof(Track))] +[TemplatePart(Name = ThumbKey, Type = typeof(FrameworkElement))] +public class PreviewSlider : Slider +``` + +# 属性 + +|属性|描述|默认值|备注| +|-|-|-|-| +|PreviewContent|预览内容||| +|PreviewContentOffset|预览内容偏移|9||| + +# 附加属性 + +|属性|描述|默认值|备注| +|-|-|-|-| +|PreviewPosition|预览位置|0||| + +# 事件 + +|名称|说明| +|-|-| +| PreviewPositionChanged | 预览位置改变时触发 | + +# 案例 + +```xml + + + + +``` + +![PreviewSlider](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/PreviewSlider.gif) \ No newline at end of file diff --git a/doc/source/handycontrol/extend_controls/progressButton/index.md b/doc/source/handycontrol/extend_controls/progressButton/index.md index ca12ad62..7fd76d1b 100644 --- a/doc/source/handycontrol/extend_controls/progressButton/index.md +++ b/doc/source/handycontrol/extend_controls/progressButton/index.md @@ -1,5 +1,31 @@ --- -title: 建设中 +title: ProgressButton 进度按钮 --- -建设中 \ No newline at end of file +在切换按钮的基础上附带了进度显示. + +```cs +public class ProgressButton : ToggleButton +``` + +# 属性 + +|属性|描述|默认值|备注| +|-|-|-|-| +|ProgressStyle|进度条样式||| +|Progress|进度|0||| + +# 案例 + +```xml + + + + + + + + +``` + +![ProgressButton](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/ProgressButton.png) \ No newline at end of file diff --git a/doc/source/handycontrol/extend_controls/rangeSlider/index.md b/doc/source/handycontrol/extend_controls/rangeSlider/index.md index d8671ff6..3fd96d19 100644 --- a/doc/source/handycontrol/extend_controls/rangeSlider/index.md +++ b/doc/source/handycontrol/extend_controls/rangeSlider/index.md @@ -1,3 +1,64 @@ --- -title: RangeSlider +title: RangeSlider 范围滑块 --- + +支持选择某一数值范围. + +```cs +public class TwoWayRangeBase : Control +``` + +```cs +[DefaultEvent("ValueChanged"), DefaultProperty("Value")] +[TemplatePart(Name = ElementTrack, Type = typeof(Track))] +public class RangeSlider : TwoWayRangeBase +``` + +# 属性 + +|属性|描述|默认值|备注| +|-|-|-|-| +|Minimum|最小值|0|| +|Maximum|最大值|0|| +|ValueStart|选中范围的开始|0|| +|ValueEnd|选中范围的结束|0|| +|LargeChange|单次最大改变值|1|| +|SmallChange|单次最小改变值|0.1|| +|Orientation|方向|Orientation.Horizontal|| +|IsDirectionReversed|是否反向|false|| +|Delay|重复点击前的等待时间||| +|Interval|重复点击触发时间间隔||| +|AutoToolTipPlacement|自动工具提示位置|AutoToolTipPlacement.None|| +|AutoToolTipPrecision|自动工具提示小数位数|0|| +|IsSnapToTickEnabled|是否自动将 Thumb 移动到最近的刻度线|false|| +|TickPlacement|刻度线的位置|TickPlacement.None|| +|TickFrequency|刻度线之间的间隔|1|| +|Ticks|刻度线绘制集合||| +|IsMoveToPointEnabled|Thumb 是否能够立即移动至鼠标点击的位置|false||| + +# 事件 + +|名称|说明| +|-|-| +| ValueChanged | 选中范围改变时触发 | + +# 案例 + +```xml + + + + + + + + + + + + + + +``` + +![RangeSlider](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/RangeSlider.png) \ No newline at end of file diff --git a/src/Shared/HandyControl_Shared/Controls/Slider/RangeSlider/RangeSlider.cs b/src/Shared/HandyControl_Shared/Controls/Slider/RangeSlider/RangeSlider.cs index 8220142a..aa9c0bd1 100644 --- a/src/Shared/HandyControl_Shared/Controls/Slider/RangeSlider/RangeSlider.cs +++ b/src/Shared/HandyControl_Shared/Controls/Slider/RangeSlider/RangeSlider.cs @@ -78,15 +78,15 @@ namespace HandyControl.Controls protected virtual void OnIncreaseLarge() => MoveToNextTick(LargeChange, false); - protected virtual void OnIncreaseSmall() => MoveToNextTick(LargeChange, false); + protected virtual void OnIncreaseSmall() => MoveToNextTick(SmallChange, false); protected virtual void OnDecreaseLarge() => MoveToNextTick(-LargeChange, true); - protected virtual void OnDecreaseSmall() => MoveToNextTick(-LargeChange, true); + protected virtual void OnDecreaseSmall() => MoveToNextTick(-SmallChange, true); protected virtual void OnCenterLarge(object parameter) => MoveToNextTick(LargeChange, false, true); - protected virtual void OnCenterSmall(object parameter) => MoveToNextTick(LargeChange, false, true); + protected virtual void OnCenterSmall(object parameter) => MoveToNextTick(SmallChange, false, true); public static RoutedCommand IncreaseLarge { get; private set; } @@ -452,15 +452,12 @@ namespace HandyControl.Controls private void OnThumbDragStarted(ToolTip toolTip, bool isStart) { - if (toolTip == null) + toolTip ??= new ToolTip { - toolTip = new ToolTip - { - Placement = PlacementMode.Custom, - PlacementTarget = isStart ? _track.ThumbStart : _track.ThumbEnd, - CustomPopupPlacementCallback = AutoToolTipCustomPlacementCallback - }; - } + Placement = PlacementMode.Custom, + PlacementTarget = isStart ? _track.ThumbStart : _track.ThumbEnd, + CustomPopupPlacementCallback = AutoToolTipCustomPlacementCallback + }; if (isStart) {