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. hadooplinux服务连接window平台问题

    window eclipse下有hadoop 服务插件可以安装方便开发,今天突然发现连接不上做测试,鼓捣了一下.大多是因为端口问题 9000是DFS端口 50020是IPC服务端口,50070是web ...

  2. 2018-11-19-windows-应用程序在关机时的退出代号

    title author date CreateTime categories windows 应用程序在关机时的退出代号 lindexi 2018-11-19 14:31:38 +0800 2018 ...

  3. [Array]217.Contains Duplicate

    Given an array of integers, find if the array contains any duplicates. Your function should return t ...

  4. 【python之路28】模块python与excel

    一.可使用的第三方库 python中处理excel表格,常用的库有xlrd(读excel)表.xlwt(写excel)表.openpyxl(可读写excel表)等.xlrd读数据较大的excel表时效 ...

  5. C# EventWaitHandle用法

    waithander就是用来阻塞当前线程的,然后通过set()方法放开 namespace waithandler { class Program { //static EventWaitHandle ...

  6. Spring事务_注解_特性

    Spring 是一个 IOC 和 AOP 容器框架. ## 控制反转(IOC) ## 传统的 java 开发模式中,当需要一个对象时,我们会自己使用 new 或者 getInstance 等直接或者间 ...

  7. CentOS安装手册

    CentOS6.5在VMware10中安装 1.启动VMware的画面 2.点击File--->New Virtual Machine 创建一台新虚拟机 3.在弹出框中选择典型安装 4.选择I ...

  8. day38 10-Spring的Bean的属性的注入

    后处理bean,如果是返回bean,那么什么都不做直接把这个类原封不动地给你返回回去. 在它执行一些逻辑方法的时候对它进行逻辑增强,比如说进行时间监控,权限管理,日志的记录等等. 要做肯定是对正常的类 ...

  9. day36 06-Hibernate抓取策略:set集合上的抓取策略

    你在做查询的时候它可以帮你关联出它的一些相应的关联对象.那么它关联这个对象的时候是在什么时候发送的这些语句以及它是如何把这些数据拿出来的? 知道延迟检索是怎么回事了,而且它也能够产生这个代理对象.当你 ...

  10. 计蒜客 Flashing Fluorescents(状压DP)

    You have nn lights, each with its own button, in a line. Pressing a light’s button will toggle that ...