原文: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的 问题的更多相关文章

  1. wpf 状态栏图标背景闪烁提醒 FlashWindowEx

    原文:wpf 状态栏图标背景闪烁提醒 FlashWindowEx using System; using System.Runtime.InteropServices; using System.Wi ...

  2. android Button背景高度被拉伸问题--解决方案

    接入第三方SDK后,发现SDK提供的弹窗里,有两个按钮的高度呈被拉伸状态. 而,第三方提供的demo内,这两个按钮均呈正常状态. 对于第一次接触Android的菜鸟来说,这个问题颇为难解.第三方在尝试 ...

  3. 【C#/WPF】Button按钮动态设置Background背景颜色

    学习笔记: 在XAML中给Button设置颜色大家都懂的,本篇只是记录用C#代码动态生成的按钮设置Background背景颜色. new一个Button,设置Background时可看到该属性类型是S ...

  4. 【WPF】Button按钮添加背景图片

    只是想做一个很简单的图片按钮而已,不需要那么复杂. <Button x:Name="btn" Width="145" Height="30&qu ...

  5. WPF中Button的背景图片,实现禁止IsMouseOver时显示默认

    <Button x:Name="btnPickUpNum" Click="PickUpNum_OnClick" Grid.Row="1" ...

  6. revit二次开发wpf里button按钮无法实现事务

    不能在revit提供的api外部使用事务,解决此方法, 1.把button里要实现的功能写到外部事件IExternalEventHandler中,注册外部事件,在button事件中.raise()使用 ...

  7. WPF 触摸屏小键盘样式

    WPF程序,用于平板时,一些输入数量的地方我们需要弹出小键盘输入,这个键盘可以调系统的,也可以自己写. 分享个我现在用的一个数字键盘界面. <Window xmlns:dxe="htt ...

  8. wpf 自定义Button按钮

    创建ButtonEx类 public class ButtonEx : Button { static ButtonEx() { DefaultStyleKeyProperty.OverrideMet ...

  9. WPF解决WindowsFormsHost背景透明

    项目案例:WPF使用WindowsFormsHost播放视频,视频上显示边框.字幕等特效: 难点问题 1.WindowsFormsHost不支持背景透明: 2.WPF Panel.ZIndex无效,W ...

随机推荐

  1. jboss-as-7.1.1.Final与jdk1.8不兼容解决方案

    今天在安装1.8电脑上装了jboss7.1.1,配置好了运行的时候就是无法启动,最后得出答案是:jboss-as-7.1.1.Final与jdk1.8不兼容 1.如果你的电脑安装了jdk1.8,那么在 ...

  2. struts2-token防止重复提交解决办法

    1.配置struts.xml全局防重复提交拦截器栈: <struts> <package name="module" extends="struts-d ...

  3. iOS开发Quartz2D之 七:雪花效果

    #import "VCView.h" @implementation VCView -(void)awakeFromNib { //[NSTimer scheduledTimerW ...

  4. Android RadioGroup的RadioButton 选择改变字体颜色和背景颜色

    RadioGroup <RadioGroup android:id="@+id/client_charge_radiogroup" android:layout_width= ...

  5. 深度理解IIS下部署ASP.NET Core2.1 Web应用拓扑图

    原文:深度理解IIS下部署ASP.NET Core2.1 Web应用拓扑图 IIS部署ASP.NET Core2.1 应用拓扑图 我们看到相比Asp.Net, 出现了3个新的组件:ASP.NET Co ...

  6. 【33.20%】【LA 4320】【Ping pong】

    [Description] N (3 ≤ N ≤ 20000) ping pong players live along a west-east street(consider the street ...

  7. [SCSS] Reuse Styles with the SCSS @extend Directive

    We can write reusable styles with the SCSS @extend or @mixin directives. Which one is better? It dep ...

  8. 使用Fernflower 比较准确的反编译整个java项目

    以前一直使用jd-gui.exe  ,都说是最好用的,但是编译总是有问题,还得修改,使用idea 后,感觉反编译的相当好,看注释是 Fernflower,然后参考 http://the.bytecod ...

  9. Android菜鸟的成长笔记(24)——Android中的振动器

    在某些时候,程序需要启动系统振动器,比如手机静音时使用振动提示用户:再比如玩游戏时,当系统碰撞.爆炸时使用振动带给用户更逼真的体验等.总之,振动是除视频.声音之外的另一种"多媒体" ...

  10. zookeeper 分布式安装/配置/启动

    版本3.4.10,已提前配置好jdk 三台主机:hadoop002,hadoop003.hadoop004 1.配置 将zookeeper-3.4.10.tar.gz解压后进入zookeeper-3. ...