modified the branch

This commit is contained in:
NaBian committed 2019-06-17 22:18:43 +08:00
1 parent a8e5738c89
commit 76f38433b5
2 files changed
+22 -37

No files matched your search

@@ -1,57 +1,42 @@
---
title: BackgroundSwitchElement
title: BackgroundSwitchElement 可切换背景的元素
---
### 附件属性名称
* MouseHoverBackground 鼠标悬浮背景颜色
* MouseDownBackground 鼠标按下背景颜色
### 准备工作
使用的当前`.xaml`页面中引入`HandyCntrol`的控件命名空间
# 准备工作
添加`HandyControl`命名空间
{% code %}
xmlns:controls="https://handyorg.github.io/handycontrol"
或
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"(老版本)
xmlns:hc="https://handyorg.github.io/handycontrol"
{% endcode %}
### MouseHoverBackground `鼠标悬浮背景颜色`
用途:该附加属性常用于自定义控件`Style`时,鼠标悬浮在控件上,属性触发器`IsMouseOver`为`true`时,设定目标控件当前鼠标悬浮状态背景色。
## MouseHoverBackground `鼠标悬浮背景色`
{% note info no-icon %}
#### 视图控件内添加MouseHoverBackground属性:
该附加属性常用于设置控件在鼠标悬浮时的背景色,在控件的样式或者模板中我们添加如下的触发器代码:
{% endnote %}
{% code %}
<控件 controls:BackgroundSwitchElement.MouseHoverBackground ="Blue"/>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="Chrome" Value="{Binding Path=(controls:BackgroundSwitchElement.MouseHoverBackground),RelativeSource={RelativeSource TemplatedParent}}"/>
</Trigger>
{% endcode %}
随后我们就可以使用该属性了:
{% note info no-icon %}
#### IsMouseOver属性触发中使用如下:
{% endnote %}
{% code %}
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="Chrome"
Value="{Binding Path=(controls:BackgroundSwitchElement.MouseHoverBackground),RelativeSource={RelativeSource TemplatedParent}}"/>
</Trigger>
<目标控件 controls:BackgroundSwitchElement.MouseHoverBackground ="Blue"/>
{% endcode %}
## MouseDownBackground `鼠标按下背景色`
### MouseDownBackground `鼠标按下背景颜色`
用途:该附加属性常用于自定义控件`Style`时,鼠标悬浮在控件上,属性触发器`IsPressed`为`true`时,设定目标控件当前鼠标按下状态背景色。
该附加属性常用于设置控件在鼠标按下时的背景色,在控件的样式或者模板中我们添加如下的触发器代码:
{% note info no-icon %}
#### 视图控件内添加MouseDownBackground属性:
{% endnote %}
{% code %}
<控件 controls:BackgroundSwitchElement.MouseDownBackground ="Yellow"/>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" TargetName="Chrome"
Value="{Binding Path=(controls:BackgroundSwitchElement.MouseHoverBackground),RelativeSource={RelativeSource TemplatedParent}}"/>
</Trigger>
{% endcode %}
{% note info no-icon %}
#### IsPressed属性触发中使用如下:
{% endnote %}
随后我们就可以使用该属性了:
{% code %}
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" TargetName="Chrome"
Value="{Binding Path=(controls:BackgroundSwitchElement.MouseHoverBackground),RelativeSource={RelativeSource TemplatedParent}}"/>
</Trigger>
<目标控件 controls:BackgroundSwitchElement.MouseDownBackground ="Yellow"/>
{% endcode %}
+1 -1
View File
@@ -4,7 +4,7 @@ title: 鸣谢
# 感谢以下Coder提供代码贡献
<p><a style="border:0" href="https://github.com/ghost1372" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars0.githubusercontent.com/u/9213496?s=400&amp;v=4" alt="ghost1372"></a><a style="border:0" href="https://github.com/DingpingZhang" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars0.githubusercontent.com/u/8541016?s=400&v=4" alt="Dingping Zhang"></a><a style="border:0" href="https://github.com/M0n7y5" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars0.githubusercontent.com/u/17201053?s=400&v=4" alt="M0n7y5"></a><a style="border:0" href="https://github.com/guanguanchuangyu" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars1.githubusercontent.com/u/25916858?s=400&v=4" alt="guanguanchuangyu"></a><a style="border:0" href="https://github.com/yanchao891012" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars0.githubusercontent.com/u/16846702?s=400&v=4" alt="guanguanchuangyu"></a></p>
<p><a style="border:0" href="https://github.com/ghost1372" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars0.githubusercontent.com/u/9213496?s=400&amp;v=4" alt="ghost1372"></a><a style="border:0" href="https://github.com/DingpingZhang" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars0.githubusercontent.com/u/8541016?s=400&v=4" alt="Dingping Zhang"></a><a style="border:0" href="https://github.com/M0n7y5" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars0.githubusercontent.com/u/17201053?s=400&v=4" alt="M0n7y5"></a><a style="border:0" href="https://github.com/guanguanchuangyu" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars1.githubusercontent.com/u/25916858?s=400&v=4" alt="guanguanchuangyu"></a><a style="border:0" href="https://github.com/yanchao891012" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars0.githubusercontent.com/u/16846702?s=400&v=4" alt="yanchao891012"></a><a style="border:0" href="https://github.com/noctwolf" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars3.githubusercontent.com/u/21022467?s=400&v=4" alt="noctwolf"></a></p>
# 感谢以下User提供使用建议