<!--按钮样式开始-->     <Style x:Key="NotifyBtnStyle" TargetType="{x:Type commondControl:ImgButton}">         <Setter Property="FocusVisualStyle"                 Value="{x:Null}" />         <Setter Property="Cursor" Value="Hand"/>         <Setter Property="Template">             <Setter.Value>                 <ControlTemplate TargetType="{x:Type commondControl:ImgButton}">                     <Grid Name="bg"                           Height="{TemplateBinding Height}"                           Width="{TemplateBinding Width}">                         <Grid.ColumnDefinitions>                             <ColumnDefinition Width="Auto" />                             <ColumnDefinition Width="*" />                         </Grid.ColumnDefinitions>                         <Image Name="ButtonImage"                                HorizontalAlignment="Center"                                VerticalAlignment="Center"                                Stretch="Fill"                                Width="{Binding ImageWidth,RelativeSource={RelativeSource TemplatedParent}}"                                Height="{Binding ImageHeight,RelativeSource={RelativeSource TemplatedParent}}"                                Source="{Binding ImageNormal,RelativeSource={RelativeSource TemplatedParent}}"                                />                         <TextBlock x:Name="text"                                    Grid.Column="1"                                    Text="{TemplateBinding Content}"                                    Margin="3,0,0,0"                                    Foreground="{TemplateBinding Foreground}"                                    HorizontalAlignment="Center"                                    VerticalAlignment="Center" />                     </Grid>

</ControlTemplate>             </Setter.Value>         </Setter>     </Style>

RelativeSource={RelativeSource TemplatedParent}的更多相关文章

  1. [WPF系列-高级TemplateBinding vs RelativeSource TemplatedParent]

    What is the difference between these 2 bindings: <ControlTemplate TargetType="{x:Type Button ...

  2. RelativeSource.TemplatedParent 属性wpf

    今天看到这一句代码时候,自己只是知道绑定了,可是不知道绑定了什么啊 就去查了一下,后来说的好像是绑定的TemplateParent返回的 一个值.可是这是为什么呢, 有的说是绑定的是一个资源. 下面有 ...

  3. 背水一战 Windows 10 (19) - 绑定: TemplateBinding 绑定, 与 RelativeSource 绑定, 与 StaticResource 绑定

    [源码下载] 背水一战 Windows 10 (19) - 绑定: TemplateBinding 绑定, 与 RelativeSource 绑定, 与 StaticResource 绑定 作者:we ...

  4. 绑定: TemplateBinding 绑定, 与 RelativeSource 绑定, 与 StaticResource 绑定

    介绍背水一战 Windows 10 之 绑定 TemplateBinding 绑定 与 RelativeSource 绑定 与 StaticResource 绑定 示例1.演示 TemplateBin ...

  5. 重新想象 Windows 8 Store Apps (52) - 绑定: 与 Element Model Indexer Style RelativeSource 绑定, 以及绑定中的数据转换

    [源码下载] 重新想象 Windows 8 Store Apps (52) - 绑定: 与 Element Model Indexer Style RelativeSource 绑定, 以及绑定中的数 ...

  6. WPF的控件Binding的ElementName/RelativeSource具体用法

    <TextBlock Name="_txtSickBedNo" FontStyle="Normal" Foreground="Black&quo ...

  7. Binding 中 Elementname,Source,RelativeSource 三种绑定的方式

    在WPF应用的开发过程中Binding是一个非常重要的部分. 在实际开发过程中Binding的不同种写法达到的效果相同但事实是存在很大区别的. 这里将实际中碰到过的问题做下汇总记录和理解. 1. so ...

  8. 在WPF中如何使用RelativeSource绑定

    在WPF绑定的时候,指定绑定源时,有一种办法是使用RelativeSource. 这种办法的意思是指当前元素和绑定源的位置关系. 第一种关系: Self 举一个最简单的例子:在一个StackPanel ...

  9. Binding RelativeSource

    IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}&q ...

随机推荐

  1. Python菜鸟之路:Django 中间件

    前言 在正式说Django中间件之前需要先了解Django一个完整的request的处理流程.我从其他网站扒了几张图过来. 图片一: 文字流程说明:如图所示,一个 HTTP 请求,首先被转化成一个 H ...

  2. Django 之 权限系统(组件)

    参考: http://www.cnblogs.com/yuanchenqi/articles/7609586.html

  3. Impala SQL 语言元素(翻译)

    摘要: http://www.cloudera.com/content/cloudera-content/cloudera-docs/Impala/latest/Installing-and-Usin ...

  4. 020-Spring Boot 监控和度量

    一.概述 通过配置使用actuator查看监控和度量信息 二.使用 2.1.建立web项目,增加pom <dependency> <groupId>org.springfram ...

  5. python学习之路-第二天-常见的注意事项(代码风格、运算符、优先级、控制语句)

    总结了今天学习几个注意事项: 对代码声明变量的时候没必要像以前写java或者c代码要声明数据类型,只需要赋值即可 代码一行基本只写一句逻辑行,而且尽量不在python里面写':' 明确的行连接'',暗 ...

  6. phonegap file api

    https://github.com/chrisben/imgcache.js/tree/master/examples 1.FILE API file api最大的两个功能是download和upl ...

  7. Python之函数总结

    一,函数的定义与调用 定义:def 关键词开头,空格之后接函数名称和圆括号(),最后还有一个":". def 是固定的,不能变,必须是连续的def三个字母,不能分开 def 函数名 ...

  8. 异动K线2--600532做一个分析时再给大家一只个股和近日大盘的分析

    http://bbs.tianya.cn/post-stocks-612892-3.shtml ————看了一页就感觉没什么太大的意义 选时重于选股 这是一条股市生存的基本法则 看看天涯真正的高手 现 ...

  9. (from) Javascript 生成指定范围数值随机数

    from:http://blog.csdn.net/ilibaba/article/details/3741786 查手册后才知道, 介绍的信息少得可怜呐, 没有介绍生成 m-n 范围的随机数..., ...

  10. Linux服务器iops性能测试-fio

    FIO是测试IOPS的非常好的工具,用来对硬件进行压力测试和验证,支持13种不同的I/O引擎,包括:sync,mmap, libaio, posixaio, SG v3, splice, null, ...