update doc

This commit is contained in:
NaBian committed 2019-10-29 01:03:20 +08:00
1 parent c16cca2dcb
commit f259e41461
23 files changed
+100 -69

No files matched your search

@@ -3,40 +3,50 @@ title: BackgroundSwitchElement 可切换背景的元素
---
# 准备工作
添加`HandyControl`命名空间
{% code %}
```xml
xmlns:hc="https://handyorg.github.io/handycontrol"
{% endcode %}
```
## MouseHoverBackground `鼠标悬浮背景色`
# 相关属性
该附加属性常用于设置控件在鼠标悬浮时的背景色,在控件的样式或者模板中我们添加如下的触发器代码:
| 名称 | 用途 |
|-|-|
| MouseHoverBackground | 设置鼠标悬浮背景色 |
| MouseDownBackground | 设置鼠标按下背景色 |
{% code %}
# 使用案例
## MouseHoverBackground 设置鼠标悬浮背景色
在样式或模板中我们添加如下的触发器代码:
```xml
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="Chrome" Value="{Binding Path=(hc:BackgroundSwitchElement.MouseHoverBackground),RelativeSource={RelativeSource TemplatedParent}}"/>
</Trigger>
{% endcode %}
```
随后我们就可以使用该属性了:
前台使用方式:
{% code %}
```xml
<目标控件 hc:BackgroundSwitchElement.MouseHoverBackground ="Blue"/>
{% endcode %}
```
## MouseDownBackground `鼠标按下背景色`
## MouseDownBackground 设置鼠标按下背景色
该附加属性常用于设置控件在鼠标按下时的背景色,在控件的样式或者模板中我们添加如下的触发器代码:
在样式或模板中我们添加如下的触发器代码:
{% code %}
```xml
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" TargetName="Chrome"
Value="{Binding Path=(hc:BackgroundSwitchElement.MouseHoverBackground),RelativeSource={RelativeSource TemplatedParent}}"/>
<Setter Property="Background" TargetName="Chrome" Value="{Binding Path=(hc:BackgroundSwitchElement.MouseDownBackground),RelativeSource={RelativeSource TemplatedParent}}"/>
</Trigger>
{% endcode %}
```
随后我们就可以使用该属性了:
前台使用方式:
{% code %}
```xml
<目标控件 hc:BackgroundSwitchElement.MouseDownBackground ="Yellow"/>
{% endcode %}
```
@@ -1,47 +1,49 @@
---
title: 具有边框的元素
title: BorderElement 具有边框的元素
---
# 准备工作
使用该系附加属性的`.xaml`文件中,需要添加`HandyControl`命名空间
{% code %}
xmlns:hc="https://handyorg.github.io/handycontrol"
{% endcode %}
添加`HandyControl`命名空间
```xml
xmlns:hc="https://handyorg.github.io/handycontrol"
```
# 相关属性
| 名称 | 用途 |
| ------------ | ---------------------------------- |
| CornerRadius | 设置边框圆角值 |
| Circular | 是否呈现为圆形 True为是、False为否 |
| 名称 | 用途 |
|-|-|
| CornerRadius | 设置边框圆角值 |
| Circular | 是否呈现为圆形 True为是、False为否 |
# 使用案例
## CornerRadius
设置边框的圆角值
## CornerRadius 设置边框圆角值
```xml
<Button Content="[Button]测试CornerRadius" hc:BorderElement.CornerRadius="0"></Button>
<hc:TextBox Text="[hc:TextBox]测试CornerRadius" hc:BorderElement.CornerRadius="15"></hc:TextBox>
<TextBox Text="[TextBox]测试CornerRadius" hc:BorderElement.CornerRadius="0"></TextBox>
<Button Content="[Button]测试CornerRadius" hc:BorderElement.CornerRadius="0,0,4,4"></Button>
```
**效果图如下:**
![CorberRadius_Case_01](..\images\borderelment_case_01.png)
## Circular
![CorberRadius_Case_01](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Doc/attach\borderelment_case_01.png)
## Circular 是否呈现为圆形
借助`BorderElement.Circular`附加属性实现圆形Border
```xml
<Border Style="{StaticResource BorderCircular}" Background="OrangeRed" Width="100" Height="100"/>
```
**效果如下:**
![borderElement_Case_02](..\images\borderElement_Case_02.png)
![borderElement_Case_02](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Doc/attach\borderElement_Case_02.png)
# 温馨提示
## 常见控件支持项
**所属** 是指该控件为`WPF默认`控件还是为`HandControl自定义`实现的控件
**适用属性 ** 为当前控件`borderElement`对应有效的附加属性
**适用属性 ** 为当前控件`BorderElement`对应有效的附加属性
| 控件类型 | 所属 | 适用属性 |
| -------- | --------------------- | ------------ |
Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

+1 -1
View File
@@ -4,6 +4,6 @@ title: 附加属性
附加属性源码在Controls / Attach文件夹中:
![Attach](images/Attach.png)
![Attach](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Doc/attach/Attach.png)
以`Element`结尾的类,可以为所有的控件设置一些共有的属性,以`Attach`结尾的类,只能为一种控件设置相关的属性。