WPF TextBox框提示文字,鼠标划入提示文字消失

<TextBox
Width=""
VerticalContentAlignment="Center"
BorderThickness=""
CaretBrush="White">
<TextBox.Resources>
<VisualBrush
x:Key="HintText"
AlignmentX="Left"
Opacity="0.5"
Stretch="None"
TileMode="None">
<VisualBrush.Visual>
<TextBlock
FontSize=""
Foreground="White"
Text="{DynamicResource MsgUser}" />
</VisualBrush.Visual>
</VisualBrush>
</TextBox.Resources>
<TextBox.Style>
<Style TargetType="TextBox">
<Setter Property="Background" Value="Transparent" />
<Style.Triggers>
<Trigger Property="Text" Value="{x:Null}">
<Setter Property="Background" Value="{StaticResource HintText}" />
</Trigger>
<Trigger Property="Text" Value="">
<Setter Property="Background" Value="{StaticResource HintText}" />
</Trigger>
<Trigger Property="IsFocused" Value="true">
<Setter Property="Background" Value="Transparent" />
</Trigger>
<!--<EventTrigger RoutedEvent="TextBox.PreviewTextInput" />-->
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>

WPF TextBox提示文字设定的更多相关文章

  1. ASP.NET TextBox 当鼠标点击后清空默认提示文字

    ASP.NET TextBox 当鼠标点击后清空默认提示文字 [ 方法一] 前台代码: <div>    <asp:TextBox ID="txtName" ru ...

  2. ASP.NET TextBox 当鼠标点击后清空默认提示文字[转]

    前台文本框里添加下面2个事件属性: OnFocus="javascript:if(this.value=='提示文字') {this.value=''}" OnBlur=" ...

  3. winform Textbox模糊搜索实现下拉显示+提示文字

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  4. C#winform如何实现文本编辑框(TextBox)的Hint提示文字效果

    C#winform如何实现文本编辑框(TextBox)的Hint提示文字效果 private const int EM_SETCUEBANNER = 0x1501; [DllImport(" ...

  5. WPF TextBox 一些设置技巧

    WPF TextBox 一些设置技巧 运行环境:Win10 x64, NetFrameWork 4.8, 作者:乌龙哈里,日期:2019-05-01 参考: 章节: 取消输入法 输入方式设定为Over ...

  6. HTML5轻松实现搜索框提示文字点击消失---及placeholder颜色的设置

    在做搜索框的时候无意间发现html5的input里有个placeholder属性能轻松实现提示文字点击消失功能,之前还傻傻的在用js来实现类似功能... 示例 <form action=&quo ...

  7. <textarea>输入框提示文字

    背景 看了过时的资料,花费大把时间,不过也有收获,还是写写吧! 分析 有同学可能想到直接在<textarea>标签内输入帮助文字,但是这又有一个新问题--因为<textarea> ...

  8. input 标签实现带提示文字的输入框

    方法一:html5配合css3实现带提示文字的输入框(摆脱js): webkit特有的一个css,可以控制里面的文字样式,配合css3的动画效果和伪类,我们就可以很容易做出一个带动画的输入框,在系统登 ...

  9. 去掉hint提示文字

    想要去掉EditText的hint提示文字,首先需要给EditText的父控件加上如下两个属性,使其获得焦点: android:focusable="true" android:f ...

随机推荐

  1. 原生JS实现彩票36选7不重复(优化)

    <!doctype html> <html> <head> <meta charset="utf-8"> <title> ...

  2. SpringBoot Jar应用Linux后台部署执行

    nohup java -jar shop-h5.jar > log_h5.file 2>&1 &

  3. Javascript-循环输出菱形,并可菱形自定义大小

    var Cen = 6;//定义菱形中部为第几行(起始值为0) //for循环输出菱形 document.write("<button onclick='xh()'>点我for循 ...

  4. No module named zope.interface error 的解决

    在 import zope.interface 时,出现错误 No module named zope.interface error根据 http://stackoverflow.com/quest ...

  5. spring boot定时任务解析

    在SpringBoot中定时任务一般使用的是@Scheduled注解. @Scheduled 1.注解内容: @Target({ElementType.METHOD, ElementType.ANNO ...

  6. JS中int和string的转换

    1.int型转换成string型 (1) var   x=100    a   =   x.toString()    (2) var   x=100;    a   =   x   +"& ...

  7. RQNOJ PID141 / 寻找代表元 [2017年6月计划 二分图01]

    PID141 / 寻找代表元 ☆ 提交你的代码 查看讨论和题解 1分前 我的状态 已通过 2017-06-28 21:03:46 运行耗时:31 ms 运行内存:28048 KB 查看最后一次评测记录 ...

  8. Leetcode49. Group Anagrams字母异位词分组

    给定一个字符串数组,将字母异位词组合在一起.字母异位词指字母相同,但排列不同的字符串. 示例: 输入: ["eat", "tea", "tan&quo ...

  9. Leetcode590N-ary Tree Postorder TraversalN叉树的后序遍历

    给定一个 N 叉树,返回其节点值的后序遍历. class Node { public: int val; vector<Node*> children; Node() {} Node(in ...

  10. 基于 DataLakeAnalytics 的数据湖实践

    随着软硬件各方面条件的成熟,数据湖(Data Lake)已经越来越受到各大企业的青睐, 与传统的数仓实践不一样的是,数据湖不需要专门的“入仓”的过程,数据在哪里,我们就从哪里读取数据进行分析.这样的好 ...