首页 > 其他 > 详细

RelativeSource={RelativeSource TemplatedParent}

时间:2015-07-01 22:01:02      阅读:268      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!