原文:潜移默化学会WPF(转载篇)--屏幕显示Label,鼠标移上去变成textBox

<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="" Width="" Loaded="Window_Loaded">
<Window.Resources>
<Style x:Key="LabelTemp" TargetType="Label">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Label">
<Grid >
<TextBox x:Name="tb" Text="{TemplateBinding Content}" Visibility="Hidden" Width="" Height=""
HorizontalAlignment="Center" VerticalAlignment="Top" FontSize=""></TextBox>
<Label x:Name="labReal" Content="{TemplateBinding Content}" Width="" Height=""
HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="" ></Label>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="tb" Property="Visibility" Value="Visible">
</Setter>
<Setter TargetName="labReal" Property="Visibility" Value="Hidden"></Setter>
</Trigger>
<Trigger Property="IsMouseOver" Value="false">
<Setter TargetName="labReal" Property="Content" Value="{Binding ElementName=tb,Path=Text}"></Setter>
</Trigger> </ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="104*" />
<ColumnDefinition Width="174*" />
</Grid.ColumnDefinitions>
<Label Name="lab" Style="{StaticResource LabelTemp}" VerticalAlignment="Top">Demo Label
</Label>
</Grid>
</Window>

原文地址  http://topic.csdn.net/u/20090324/14/349de2ff-f12e-4d7a-8a37-ca3318b63b51.html

潜移默化学会WPF(转载篇)--屏幕显示Label,鼠标移上去变成textBox的更多相关文章

  1. 潜移默化学会WPF(绚丽篇)--热烈欢迎RadioButton,改造成功,改造成ImageButton,新版导航

    原文:潜移默化学会WPF(绚丽篇)--热烈欢迎RadioButton,改造成功,改造成ImageButton,新版导航 本样式 含有  触发器 和 动画    模板  ,多条件触发器,还有布局 本人博 ...

  2. 潜移默化学会WPF(难点控件treeview)--改造TreeView(CheckBox多选择版本),递归绑定数据

    原文:潜移默化学会WPF(难点控件treeview)--改造TreeView(CheckBox多选择版本),递归绑定数据 目前自己对treeview的感慨很多 今天先讲 面对这种 表结构的数据 的其中 ...

  3. WPF之路-键盘与鼠标事件 - 简书

    原文:WPF之路-键盘与鼠标事件 - 简书 键盘事件 事件类型分为以下几个类型 生命周期事件:在元素加载与卸载的时候发生 鼠标事件:鼠标动作 键盘事件:键盘动作 手写笔事件:适用于win7以上的系统 ...

  4. WPF 精修篇 数据触发器

    原文:WPF 精修篇 数据触发器 数据触发器 可以使用Binding 来绑定控件 或者数据源 来触发相关动作 举栗子 <Window.Resources> <Style Target ...

  5. WPF 精修篇 属性触发器

    原文:WPF 精修篇 属性触发器 属性触发器是通过  某个条件触发改变属性 通过无代码实现功能 <Style TargetType="{x:Type Label}"> ...

  6. WPF 精修篇 拖拽 DragDrop

    原文:WPF 精修篇 拖拽 DragDrop WPF 实现拖拽 效果 <Grid> <Grid.ColumnDefinitions> <ColumnDefinition ...

  7. WPF 精修篇 BackgroundWorker

    原文:WPF 精修篇 BackgroundWorker 效果 <Grid> <Grid.RowDefinitions> <RowDefinition Height=&qu ...

  8. WPF 精修篇 长时间线程加取消功能

    原文:WPF 精修篇 长时间线程加取消功能 <Grid> <Grid.RowDefinitions> <RowDefinition Height="11*&qu ...

  9. WPF 精修篇 非UI进程后台更新UI进程

    原文:WPF 精修篇 非UI进程后台更新UI进程 <Grid> <Grid.RowDefinitions> <RowDefinition Height="11* ...

随机推荐

  1. Spring boot(二) springboot + jsp

    官方不推荐JSP在Spring Boot中使用! 一.添加依赖 在pim.xml 里面添加以下 jsp依赖 <dependency> <groupId>org.springfr ...

  2. spring getbean 方法分析(很实用!)

    十年阿里,就只剩下这套Java开发体系了 >>>   在最近的项目中,有个地方我们不得不实用getBean的方法,自己从Spring context中获取bean进行数据库操作. 方 ...

  3. php 字符串 去掉 html标签

    echo strip_tags("Hello <b>world!</b>");

  4. EChats+Ajax之柱状图的数据交互

    原文链接:https://blog.csdn.net/qq_37936542/article/details/79723710 一:下载 echarts.min.js 选择完整版进行下载,精简版和常用 ...

  5. JAVA获取文件本身所在的磁盘位置

    我们在做java开发(纯java程序,或者java web开发)时,经常会遇到需要读取配置文件的需求,如果我们将文件所在位置的信息直接写到程序中,例如:e:\workspace\javagui\bin ...

  6. 使用oschina的gitserver

    1.概要 事实上oschina的gitserver与github的几乎相同.只是既然是中国的gitserver,那么速度应该更快一些吧 2.注冊 链接https://git.oschina.net/, ...

  7. mysql官网下载linux版本安装包

    原文地址:点击打开链接 今天在Linux上部署项目,用到了Mysql,因此想要下载适用于Linux的安装版本,在Mysql官网找了半天,终于找到怎样下载了,这里写出来,以后大家找的时候就好找了. 第一 ...

  8. spring mvc redirect 重定向 跳转并传递参数

    在项目中做form表单功能提交时,防止用户客户端后退或者刷新时重复提交问题,需要在服务端进行重定向跳转,具体跳转方式有以下几种方式: 公用代码: @RequestMapping(value=" ...

  9. [HTML5] Using the tabindex attribute for keyboard accessibility

    You can make any element keyboard interactive with the HTML tabindex attribute. But you might need a ...

  10. 【v2.x OGE-example 第一节】 绘制实体

    前言: OGE即 OGEngine,是由橙子游戏开发的基于Java支持跨平台的开源游戏引,从12年4月项目成立至今已经有2年多的发展历程.在此期间基于OGEngine开发的项目已经有非常多成功投放市场 ...