In our project we have default style for button, which defines template for button and there is a Border
with property CornerRadius="0"
:
<Style TargetType="Button" x:Key="TemplatedButton">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border BorderBrush="{TemplateBinding BorderBrush}"
CornerRadius="0"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
Padding="{TemplateBinding Padding}"
Cursor="{TemplateBinding Cursor}"
>
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
RecognizesAccessKey="True"
/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Button
control has no property CornerRadius
, so it's imposible to bind that property to TemplateBinding
, but for some control we need to customize CornerRadius property:
<Button Style="{StaticResource TemplatedButton}" x:Name="btn1" Content="Button with radius" /*HERE WE NEED TO SET CUSTOM CornerRadius*/ />
Is it possible to somehow change that Corner radius? Maybe in style that inherits it or by adding resources to btn1?
I saw that it possible to customize default properties by setting resource with same key to different value, but don't know how to implement that. Will appreciate if you provide any tutorials or documentation on how to implement that.