<!--按钮样式开始-->     <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. Webshell清除-解决驱动级文件隐藏挂马

    Webshell清除-解决驱动级文件隐藏挂马

  2. FW ImageMagick

    ExploitFixes ImageMagick < 6.9.3-9 - Multiple Vulnerabilities 2016-05-04 22:05:53 Nikolay Ermishk ...

  3. Parzen-Window Density Estimation(PWDE)

    1.概率密度函数 在在数学中,连续型随机变量的概率密度函数(在不至于混淆时可以简称为密度函数)是一个描述这个随机变量的输出值,在某个确定的取值点附近的可能性的函数.而随机变量的取值落在某个区域之内的概 ...

  4. 20170401 错了两天的-XML解析

    你不找到的话,错误就在那里.你找到了错误才会成为财富! Strans XML 解析3要素:1.源xml 格式正常, eg. '<?xml version="1.0" enco ...

  5. C#对excel的操作

    本文先描述如何用c#连接.操作excel文件. 项目中需要引入的DLL文件为Interop.Excel.Interop.Microsoft.Office.Core.Interop.Office等. 操 ...

  6. iOS视图生命周期

    视图是应用的一个重要组成部分,功能的实现与其息息相关,而视图控制器控制着视图,其重要性在整个应用中不言而喻. 1.视图生命周期与视图控制器关系 以视图的4 种状态为基础,我们来系统了解一下视图控制器的 ...

  7. NodeJS应用程序设置为window service-辅助工具(C#)

    1.修改nssm,去对话框后 2.生成批处理文件,执行 3.将nssm.exe.node.exe放在资源文件里面 附代码 工具

  8. 011_Eclipse中使用HDFSFileSystemAPI事例介绍

    需求 1.文件操作 1)上传本地文件到HDFS 2)读取文件 3)在hadoopfs中新建文件,并写入 4)重命名文件 5)删除hadoopfs上的文件 2.目录操作 1)读取某个目录下的所有文件 2 ...

  9. Keepalived 主备配置

    keepalived主备或多主多备,配置都是一样配置方法,只是搭建多少的问题. 1.keepalived安装 参考:https://www.cnblogs.com/zwcry/p/9542867.ht ...

  10. python tkinter组件学习

    http://blog.csdn.net/pfm685757/article/details/50162567