This commit is contained in:
1 parent
72d9b295a0
commit
5d81c475c8
335 files changed
+7359
No files matched your search
@@ -0,0 +1,39 @@
|
||||
---
|
||||
name: handycontrol-wpf-numeric-up-down
|
||||
description: "实现、配置或排查 HandyControl WPF 的 NumericUpDown 数值选择控件(NumericUpDown)。适用于该扩展控件的 XAML、绑定、事件和模板;不用于 Avalonia 或其他厂商控件。"
|
||||
---
|
||||
|
||||
# HandyControl WPF NumericUpDown 数值选择控件
|
||||
|
||||
实现或排查 **NumericUpDown 数值选择控件**。相关类型:`NumericUpDown`。
|
||||
|
||||
## 接入
|
||||
|
||||
程序集/NuGet 为 `HandyControl`,XAML 命名空间为
|
||||
`xmlns:hc="https://handyorg.github.io/handycontrol"`,C# 控件命名空间为 `HandyControl.Controls`。
|
||||
在 `App.xaml` 合并 `pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml`,
|
||||
然后合并 `pack://application:,,,/HandyControl;component/Themes/Theme.xaml`。
|
||||
已有主题配置时先检查,避免重复合并。版本和目标框架以使用方项目为准。
|
||||
|
||||
## 实现
|
||||
|
||||
先读 [API 声明与继承关系](references/api.md),再按需求查看
|
||||
[文档、样式与示例导航](references/usage.md)。源码路径相对于 HandyControl 仓库根目录;
|
||||
在本仓库优先读本地文件,安装到其他项目后使用内附声明与链接,遇到版本差异检查实际引用版本的源码。
|
||||
不要将 Demo 的 langs、ex:Lang、ViewModelLocator 或示例资源直接复制进使用方项目。
|
||||
|
||||
Value 是 double;范围属性是 Minimum / Maximum,步长是 Increment,不能照搬 Syncfusion 的 MinValue / MaxValue / Step。DecimalPlaces 为 int?,仅控制显示。ValueChanged 的事件参数使用 FunctionEventArgs<double>,读取 Info;绑定时显式指定 Mode=TwoWay。
|
||||
|
||||
用目标项目现有的 MVVM 方式绑定;需要回写时明确 TwoWay 和更新时机,
|
||||
不要假定所有依赖属性默认双向绑定。原生 WPF 与 HandyControl 同名类型使用命名空间区分。
|
||||
交付时运行目标框架的构建,并在窗口加载后检查模板、绑定错误、空值和相关输入边界;
|
||||
无法运行 WPF 时明确说明尚未验证 UI 行为。
|
||||
|
||||
## 最小片段
|
||||
|
||||
依赖上面的应用资源配置;Binding 路径由使用方 ViewModel 提供。
|
||||
|
||||
```xml
|
||||
<hc:NumericUpDown Minimum="0" Maximum="100" Increment="0.5"
|
||||
DecimalPlaces="2" Value="{Binding Amount, Mode=TwoWay}"/>
|
||||
```
|
||||
@@ -0,0 +1,4 @@
|
||||
interface:
|
||||
display_name: "HandyControl WPF NumericUpDown 数值选择控件"
|
||||
short_description: "Implement HandyControl WPF controls from verified source guidance"
|
||||
default_prompt: "Use $handycontrol-wpf-numeric-up-down to implement the requested HandyControl WPF UI."
|
||||
@@ -0,0 +1,26 @@
|
||||
# 源码 API 导航
|
||||
|
||||
下面是当前工作区的声明摘录,不是完整 C# 文件,不包含全部继承成员、访问器和条件编译条件。属性是否可写、依赖属性默认值、枚举成员和目标框架限制,需打开对应源码核对。
|
||||
|
||||
## NumericUpDown
|
||||
|
||||
源码:[src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs](https://github.com/HandyOrg/HandyControl/blob/master/src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs)
|
||||
|
||||
```text
|
||||
public class NumericUpDown : Control
|
||||
public NumericUpDown()
|
||||
public override void OnApplyTemplate()
|
||||
public event EventHandler<FunctionEventArgs<double>> ValueChanged
|
||||
public double Value
|
||||
public double Maximum
|
||||
public double Minimum
|
||||
public double Increment
|
||||
public int? DecimalPlaces
|
||||
public string ValueFormat
|
||||
public bool ShowUpDownButton
|
||||
public bool IsReadOnly
|
||||
public Brush SelectionBrush
|
||||
public Brush SelectionTextBrush
|
||||
public double SelectionOpacity
|
||||
public Brush CaretBrush
|
||||
```
|
||||
@@ -0,0 +1,17 @@
|
||||
# NumericUpDown 数值选择控件 使用导航
|
||||
|
||||
文档:[doc/source/handycontrol/extend_controls/numericUpDown/index.md](https://github.com/HandyOrg/HandyControl/blob/master/doc/source/handycontrol/extend_controls/numericUpDown/index.md)
|
||||
|
||||
在线文档:[控件说明](https://handyorg.github.io/handycontrol/extend_controls/numericUpDown/)
|
||||
|
||||
按任务阅读原文中的章节:创建NumericUpDown并设置Value、设置DecimalPlaces、设置Increment、设置上限和下限、设置标题和占位符文本、属性、事件。
|
||||
|
||||
## 当前源码
|
||||
|
||||
- [src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs](https://github.com/HandyOrg/HandyControl/blob/master/src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs)
|
||||
|
||||
## 样式及官方示例
|
||||
|
||||
- [src/Shared/HandyControl_Shared/Themes/Styles/NumericUpDown.xaml](https://github.com/HandyOrg/HandyControl/blob/master/src/Shared/HandyControl_Shared/Themes/Styles/NumericUpDown.xaml)
|
||||
- [src/Shared/HandyControlDemo_Shared/UserControl/Controls/NumericUpDownDemo.xaml](https://github.com/HandyOrg/HandyControl/blob/master/src/Shared/HandyControlDemo_Shared/UserControl/Controls/NumericUpDownDemo.xaml)
|
||||
- [src/Shared/HandyControlDemo_Shared/UserControl/Controls/NumericUpDownDemo.xaml.cs](https://github.com/HandyOrg/HandyControl/blob/master/src/Shared/HandyControlDemo_Shared/UserControl/Controls/NumericUpDownDemo.xaml.cs)
|
||||
Reference in new issue
Block a user