RelativeSource={RelativeSource TemplatedParent}
<!--按钮样式开始--> <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}的更多相关文章
- [WPF系列-高级TemplateBinding vs RelativeSource TemplatedParent]
What is the difference between these 2 bindings: <ControlTemplate TargetType="{x:Type Button ...
- RelativeSource.TemplatedParent 属性wpf
今天看到这一句代码时候,自己只是知道绑定了,可是不知道绑定了什么啊 就去查了一下,后来说的好像是绑定的TemplateParent返回的 一个值.可是这是为什么呢, 有的说是绑定的是一个资源. 下面有 ...
- 背水一战 Windows 10 (19) - 绑定: TemplateBinding 绑定, 与 RelativeSource 绑定, 与 StaticResource 绑定
[源码下载] 背水一战 Windows 10 (19) - 绑定: TemplateBinding 绑定, 与 RelativeSource 绑定, 与 StaticResource 绑定 作者:we ...
- 绑定: TemplateBinding 绑定, 与 RelativeSource 绑定, 与 StaticResource 绑定
介绍背水一战 Windows 10 之 绑定 TemplateBinding 绑定 与 RelativeSource 绑定 与 StaticResource 绑定 示例1.演示 TemplateBin ...
- 重新想象 Windows 8 Store Apps (52) - 绑定: 与 Element Model Indexer Style RelativeSource 绑定, 以及绑定中的数据转换
[源码下载] 重新想象 Windows 8 Store Apps (52) - 绑定: 与 Element Model Indexer Style RelativeSource 绑定, 以及绑定中的数 ...
- WPF的控件Binding的ElementName/RelativeSource具体用法
<TextBlock Name="_txtSickBedNo" FontStyle="Normal" Foreground="Black&quo ...
- Binding 中 Elementname,Source,RelativeSource 三种绑定的方式
在WPF应用的开发过程中Binding是一个非常重要的部分. 在实际开发过程中Binding的不同种写法达到的效果相同但事实是存在很大区别的. 这里将实际中碰到过的问题做下汇总记录和理解. 1. so ...
- 在WPF中如何使用RelativeSource绑定
在WPF绑定的时候,指定绑定源时,有一种办法是使用RelativeSource. 这种办法的意思是指当前元素和绑定源的位置关系. 第一种关系: Self 举一个最简单的例子:在一个StackPanel ...
- Binding RelativeSource
IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}&q ...
随机推荐
- diff工具
Beyond Compare 4 可以diff文件夹.单个文件.
- mysql大致学习路径
- Unity3D游戏开发从零单排(六) - 人物运动及攻击连击
提要 今天要实现的是一个简单人物控制器. 包括用w,a,s,d来控制人物上下左右跑动,鼠标左击发出连招,都是基于老的lagacy的动画.尽管unity3d自带有charactorcontroller, ...
- Python基础-configparser和hashlib模块
configparser模块 import configparser config = configparser.ConfigParser() #将配置写入到文件 config[', 'Compres ...
- hadoop学习第四天-Writable和WritableComparable序列化接口的使用&&MapReduce中传递javaBean的简单例子
一. 为什么javaBean要继承Writable和WritableComparable接口? 1. 如果一个javaBean想要作为MapReduce的key或者value,就一定要实现序列化,因为 ...
- 极速Node.js:来自LinkedIn的10个性能提升秘籍
from:http://faylai.iteye.com/blog/1293194 1.避免使用同步的方法 nodejs 是基于单线程.为了让单线程能够处理高并发的请求,我们尽量要避免让线程等待,阻塞 ...
- 从yum源下载软件包
以下是从163源下载openstack-ocata版软件包的脚本: from html.parser import HTMLParser from urllib import request impo ...
- Web前端开发的基本要求和认识
Web前端开发技术包括三个要素:HTML.CSS和JavaScript,但随着RIA的流行和普及,Flash/Flex.Silverlight.XML和服务器端语言也是前端开发工程师应该掌握的.Web ...
- ORACLE对象模式
在oracle数据库中,数据对象是以模式(Schema)为单位进行组织和管理的.所谓模式是指一系列逻辑数据结构或对象的集合. 模式与用户相对应,一个模式只能被一个数据库用户所拥有,并且模式名称与这个用 ...
- hi3515 rtc驱动(ds1307/1339)驱动和示例
将驱动放入/extdrv中编译 部分驱动如下: #include <linux/module.h> #include <linux/miscdevice.h>#include ...