当前位置: 代码迷 >> .NET Framework >> wpf_templatebinding,该怎么处理
  详细解决方案

wpf_templatebinding,该怎么处理

热度:215   发布时间:2016-05-01 23:21:16.0
wpf_templatebinding
<Window.Resources>
        <ControlTemplate x:Key="myCT">
            <Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="1" CornerRadius="50" Background="DarkRed">
                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding ContentControl.Content}"/>
                </Border>
        </ControlTemplate>
 </Window.Resources>

这段代码中的control.borderbrush, Contentpresenter, contentcontrol.content都是什么意思呀?
还有,CornerRadius怎么通过绑定来设置大小,比如做一个圆形button。
这个代码是嵌套在style里头的,所以style标签的目标类型是button。写cornerradius="{Binding Width}"也无法实现?
------解决思路----------------------
CornerRadius   作为一个 依赖属性  注册到button类,然后使用templatebinding
  相关解决方案