码迷,mamicode.com
首页 > 其他好文 > 详细

RelativeSource={RelativeSource TemplatedParent}

时间:2015-07-01 22:01:52      阅读:116      评论:0      收藏:0      [点我收藏+]

标签:

<!--按钮样式开始-->     <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}

标签:

原文地址:http://www.cnblogs.com/changbaishan/p/4614501.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!