wpf 触摸屏 button 背景为null的 问题
<!-- button样式-->
<Style x:Key="myBtn" TargetType="Button" >
<!--<Setter Property="Background" Value="{x:Null}" />-->
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="White"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}" >
<Border Name="btnBorder" BorderBrush="{TemplateBinding Control.BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="12"
Background="{TemplateBinding Control.Background}" >
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="Control.IsMouseOver" Value="true">
<Setter Property="Control.Background" Value="#3c4d70" />
<Setter Property="BorderThickness" Value="0"/>
</Trigger>
<Trigger Property="Control.IsFocused" Value="true">
<Setter Property="Control.Background" Value="#3c4d70" />
<Setter Property="BorderThickness" Value="0"/>
</Trigger>
</Style.Triggers>
</Style>
当使用背景注释行的 x:null 时 在触摸屏上 必须点击button按钮中间的内容才有 click事件,而button 内容周围的 区域 都无点击效果
改为使用 Transparent 时 才能在整个button
wpf 触摸屏 button 背景为null的 问题的更多相关文章
- wpf 状态栏图标背景闪烁提醒 FlashWindowEx
原文:wpf 状态栏图标背景闪烁提醒 FlashWindowEx using System; using System.Runtime.InteropServices; using System.Wi ...
- android Button背景高度被拉伸问题--解决方案
接入第三方SDK后,发现SDK提供的弹窗里,有两个按钮的高度呈被拉伸状态. 而,第三方提供的demo内,这两个按钮均呈正常状态. 对于第一次接触Android的菜鸟来说,这个问题颇为难解.第三方在尝试 ...
- 【C#/WPF】Button按钮动态设置Background背景颜色
学习笔记: 在XAML中给Button设置颜色大家都懂的,本篇只是记录用C#代码动态生成的按钮设置Background背景颜色. new一个Button,设置Background时可看到该属性类型是S ...
- 【WPF】Button按钮添加背景图片
只是想做一个很简单的图片按钮而已,不需要那么复杂. <Button x:Name="btn" Width="145" Height="30&qu ...
- WPF中Button的背景图片,实现禁止IsMouseOver时显示默认
<Button x:Name="btnPickUpNum" Click="PickUpNum_OnClick" Grid.Row="1" ...
- revit二次开发wpf里button按钮无法实现事务
不能在revit提供的api外部使用事务,解决此方法, 1.把button里要实现的功能写到外部事件IExternalEventHandler中,注册外部事件,在button事件中.raise()使用 ...
- WPF 触摸屏小键盘样式
WPF程序,用于平板时,一些输入数量的地方我们需要弹出小键盘输入,这个键盘可以调系统的,也可以自己写. 分享个我现在用的一个数字键盘界面. <Window xmlns:dxe="htt ...
- wpf 自定义Button按钮
创建ButtonEx类 public class ButtonEx : Button { static ButtonEx() { DefaultStyleKeyProperty.OverrideMet ...
- WPF解决WindowsFormsHost背景透明
项目案例:WPF使用WindowsFormsHost播放视频,视频上显示边框.字幕等特效: 难点问题 1.WindowsFormsHost不支持背景透明: 2.WPF Panel.ZIndex无效,W ...
随机推荐
- Synopsys工艺库札记
Synopsys工艺库札记 库的基本信息 库类 库类语句指定库名. library ( smic13HT_ss ) { ... <lirary description> ... } /*e ...
- Codeforces Round #315 (Div. 2)——C. Primes or Palindromes?
这道题居然是一个大暴力... 题意: π(n):小于等于n的数中素数的个数 rub(n) :小于等于n的数中属于回文数的个数 然后给你两个数p,q,当中A=p/q. 然后要你找到对于给定的A.找到使得 ...
- Web报表工具FineReport实现EXCEL数据导入自由报表
在制作填报报表的时候.对于空白填报表,经常导出为Excel,派发给各部门人员填写后上交.怎样能避免手动输入,直接将Excel中的数据导入到填报表中提交入库呢? 这里以一个简单的员工信息填报演示样例进行 ...
- JAVA生成二维码并转化为二进制在页面展示
引用jar包: zxing的core包,下载路径可参考:http://download.csdn.net/detail/sxg0205/9461106 java代码: 引用包: import java ...
- C语言学习笔记:12_变量的存储方式和生存期
/* * 12_变量的存储方式和生存期.c * * Created on: 2015年7月5日 * Author: zhong */ #include <stdio.h> #include ...
- [Angular Directive] Structure directive and <template>
The structure directive is just a sugar syntax of <template>. Such as: <div *ngIf="nam ...
- Cocos2d-x 3.2 Lua演示样例FontTest(字体測试)
Cocos2d-x 3.2 Lua演示样例FontTest(字体測试) 本篇博客介绍Cocos2d-x 3.2中Lua測试项目中的FontTest样例,主要使用了字体文件来创建我们想要的字体样式: 第 ...
- Web开发标配--开发人员工具-F12
喜欢从业的专注,七分学习的态度. 360浏览器-开发工具 谷歌-开发工具 IE-开发工具 Web开发中最最烦琐的莫过于调整CSS和JS,而最方便最高效的方式就是利用浏览器的开发工具调整.CSS可以实时 ...
- 使用Delegate在两个ViewController之间传值
以下就实现了使用Delegate在两个ViewController之间传值,这种场景一般应用在进入子界面输入信息,完后要把输入的信息回传给前一个界面的情况,比如修改用户个人信息,点击修改进入修改界面, ...
- 【BZOJ 1012】 [JSOI2008]最大数maxnumber(单调队列做法)
[题目链接]:http://www.lydsy.com/JudgeOnline/problem.php?id=1012 [题意] [题解] 后加入的元素,如果比之前的元素大, 那么之前的元素比它小的元 ...