<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