Merge pull request #354 from HandyOrg/pr/347

Pr/347
This commit is contained in:
NaBian authored and GitHub committed 2020-04-04 15:22:50 +08:00
commit d083df2b42
8 files changed
+199 -22

No files matched your search

@@ -1,5 +0,0 @@
---
title: 建设中
---
建设中
@@ -1,5 +1,57 @@
---
title: 建设中
title: Clock 时钟
---
建设中
Clock 控件展示一个虚拟的时钟,允许用户在这个时钟上选择时间。
``` CS
[TemplatePart(Name = ElementButtonAm, Type = typeof(RadioButton))]
[TemplatePart(Name = ElementButtonPm, Type = typeof(RadioButton))]
[TemplatePart(Name = ElementCanvas, Type = typeof(Canvas))]
[TemplatePart(Name = ElementBorderTitle, Type = typeof(Border))]
[TemplatePart(Name = ElementBorderClock, Type = typeof(Border))]
[TemplatePart(Name = ElementPanelNum, Type = typeof(CirclePanel))]
[TemplatePart(Name = ElementTimeStr, Type = typeof(TextBlock))]
public class Clock : ClockBase
```
# 创建Clock
``` XML
<hc:Clock />
```
``` CS
var clock = new Clock();
```
生成的Clock如下图所示:
![Clock](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Doc/extend_controls/Clock_1.png)
# 选择时间
可以通过点击左边的时钟,或者点击右边的时分秒列表选择时间。也可以在XAML钟或代码中这样设置日期。
``` XML
<hc:Clock SelectedTime="{x:Static system:DateTime.Now}"/>
```
``` CS
clock.SelectedTime = DateTime.Now;
```
# 属性
| 属性 | 描述 |
| ---------------- | ------------------ |
| SelectedTime | 获取或设置当前选中的时间。 |
| DisplayTime | 获取或设置当前的显示时间。 |
| TimeFormat | 获取或设置用于显示选定的时间的格式 |
| ClockRadioButtonStyle | 获取或设置Clock控件中RadioButton的样式 |
# 事件
| 事件 | 描述 |
| ---------------- | ------------------ |
| DisplayTimeChanged | 当显示的时间改变时发生。 |
@@ -1,5 +1,5 @@
---
title: 建设中
title: 扩展控件
---
建设中
HandyControl目前包含70余款扩展控件,正逐步增加。
@@ -1,5 +1,77 @@
---
title: 建设中
title: PasswordBox 密码框
---
建设中
表示用于输入和处理密码的控件。
``` CS
[TemplatePart(Name = ElementPasswordBox, Type = typeof(System.Windows.Controls.PasswordBox))]
[TemplatePart(Name = ElementTextBox, Type = typeof(System.Windows.Controls.TextBox))]
public class PasswordBox : Control, IDataInput
```
# 创建PasswordBox
``` XML
<hc:PasswordBox />
```
``` CS
var passwordBox = new PasswordBox();
```
# 输入密码
可以通过文本框输入密码,也可以在XAML钟或代码中这样设置日期。
``` XML
<hc:PasswordBox Password="123456"/>
```
``` CS
passwordBox.Password = "123456";
```
# 显示密码
PasswordBox控件可以主动显示已输入的密码。将`ShowEyeButton`设置为`true`,PasswordBox将显示一个“眼睛”的按钮,点击这个按钮即可显示已输入的密码。
``` XML
<hc:PasswordBox ShowClearButton="True"/>
```
![PasswordBox](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Doc/extend_controls/PasswordBox_2.gif)
# 设置标题和占位符文本
你可以将 Header(标题)和 Placeholder(占位符)添加到PasswordBox,以向用户指示其用途。
``` XML
<hc:PasswordBox hc:InfoElement.Placeholder="{x:Static langs:Lang.PlsEnterContent}"
hc:InfoElement.Title="{x:Static langs:Lang.TitleDemoStr2}"
```
# 属性
| 属性 | 描述 |
| ---------------- | ------------------ |
| Password | 获取或设置 PasswordBox 当前保留的密码。 |
| PasswordChar | 获取或设置 PasswordBox 的掩码字符。 |
| ShowEyeButton | 获取或设置是否显示一个“眼睛”的按钮,点击可以显示密码。 |
| ShowPassword | 获取或设置是否显示密码。 |
| Text | 获取由 **TimePicker** 显示的文本,或设置选定的时间 |
| VerifyFunc | 获取或设置数据验证委托 |
| IsError | 获取或设置数据是否错误 |
| ErrorStr | 获取或设置错误提示 |
| TextType | 获取或设置文本类型 |
| ShowClearButton | 获取或设置是否显示清除按钮 |
# 方法
| 方法 | 描述 |
| ---------------- | ------------------ |
| Clear() | 清除 Password 属性的值。 |
| Paste() | 用剪贴板中的内容替换 PasswordBox 中的当前选定内容。 |
| SelectAll() | 选择 PasswordBox 中的全部内容。 |
| VerifyData() | 验证数据。 |
@@ -1,5 +0,0 @@
---
title: 建设中
---
建设中
@@ -1,5 +1,66 @@
---
title: 建设中
title: TextBox 文本框
---
建设中
表示一个控件,该控件可用于显示或编辑无格式文本。
``` CS
public class TextBox : System.Windows.Controls.TextBox, IDataInput
```
# 创建TextBox
``` XML
<hc:TextBox />
```
``` CS
var textBox = new TextBox();
```
# 输入文本
此示例演示如何使用 Text 属性设置 TextBox 控件的初始文本内容:
``` XML
<hc:TextBox Text="这是内容"/>
```
``` CS
textBox.Text = "这是内容";
```
生成的TextBox如下图所示:
![TextBox](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Doc/extend_controls/TextBox_1.png)
有关TextBox的更多示例,可以参考它的基类的[文档](https://docs.microsoft.com/zh-cn/dotnet/api/system.windows.controls.textbox?view=netframework-4.8)。
# 设置标题和占位符文本
你可以将 Header(标题)和 Placeholder(占位符)添加到TextBox,以向用户指示其用途。要使用这两个属性,
``` XML
<hc:TextBox hc:InfoElement.Placeholder="{x:Static langs:Lang.PlsEnterContent}"
hc:InfoElement.Title="{x:Static langs:Lang.TitleDemoStr2}"
```
# 属性
| 属性 | 描述 |
| ---------------- | ------------------ |
| Text | 获取或设置文本框的文本内容。 |
| VerifyFunc | 获取或设置数据验证委托。 |
| IsError | 获取或设置数据是否错误。 |
| ErrorStr | 获取或设置错误提示。 |
| TextType | 获取或设置文本类型。 |
| ShowClearButton | 获取或设置是否显示清除按钮。 |
# 方法
| 方法 | 描述 |
| ---------------- | ------------------ |
| VerifyData() | 验证数据。 |
+1 -3
View File
@@ -231,8 +231,7 @@ menu:
default: /extend_controls/ ||
AnimationPath 动画路径: /animationPath/ ||
Badge 标记: /badge/ ||
ButtonGroup : /buttonGroup/ ||
BlurWindow 背景模糊窗口: /blurWindow/ ||
ButtonGroup 按钮组: /buttonGroup/ ||
CalendarWithClock 带有时钟的日历: /calendarWithClock/ ||
Card 卡片: /card/ ||
Carousel 轮播: /carousel/ ||
@@ -276,7 +275,6 @@ menu:
PreviewSlider 预览滑块: /previewSlider/ ||
ProgressButton 进度按钮: /progressButton/ ||
RangeSlider 范围滑块: /rangeSlider/ ||
RadioGroup 单选按钮组: /radioGroup/ ||
Rate 评分: /rate/ ||
RelativePanel 相对布局: /relativePanel/ ||
RunningBlock 滚动块: /runningBlock/ ||
@@ -40,7 +40,11 @@ namespace HandyControl.Controls
Info = (double)e.NewValue
});
protected virtual void OnValueChanged(FunctionEventArgs<double> e) => RaiseEvent(e);
protected virtual void OnValueChanged(FunctionEventArgs<double> e)
{
RaiseEvent(e);
UpdateItems();
}
public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
"Text", typeof(string), typeof(Rate), new PropertyMetadata(default(string)));