原文: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. stl变易算法(一)

    C++ STL的变易算法是一组可以改动容器元素数据的模板函数,可进行序列容器的复制.交换.替换.填充.移除.旋转等.这些算法对迭代器有较高的要求.详细的迭代器类型随各个算法而定,或向前迭代器.或双向迭 ...

  2. ConcurrentLinkedQueue使用方法

    它是一个基于链接节点的无界线程安全队列.该队列的元素遵循先进先出的原则.头是最先加入的,尾是最近加入的. 插入元素是追加到尾上.提取一个元素是从头提取.当多个线程共享访问一个公共 collection ...

  3. 【30.49%】【codeforces 569A】Music

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  4. Linux下停Tomcat服务器,出现Connection refused错误解决办法

    错误内容如下 : 2010-9-19 16:09:58 org.apache.catalina.startup.Catalina stopServer 严重: Catalina.stop: java. ...

  5. java 原子量Atomic举例(AtomicReference)

    java并发库提供了很多原子类来支持并发访问的数据安全性,除了常用的 AtomicInteger.AtomicBoolean.AtomicLong 外还有 AtomicReference 用以支持对象 ...

  6. [NPM] Pass arguments to npm scripts

    Often times you’ll have variations that you’ll want to make to your npm scripts and repeating yourse ...

  7. [SVG] Add an SVG as an Embedded Background Image

    Learn how to set an elements background image to embedded SVG. This method has an added benefit of n ...

  8. Javascript中eval解析的json的几种用法

    eval解析json字符串可用的三种方式都可以实现... <!DOCTYPE html> <html> <head> <meta charset=" ...

  9. 关于Boolean类型做为同步锁异常问题

    public class Test2 { private static volatile Boolean aBoolean = true; static class A implements Runn ...

  10. poj1995 Raising Modulo Numbers【高速幂】

    Raising Modulo Numbers Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 5500   Accepted: ...