Can you databind to CornerRadius via WPF Styles?

I have a Button style and can't seem to property databind the border's CornerRadius property to the template. This is a dependency property, so it should be data bindable. I wonder if I'm missing the right XAML syntax to use?

<Style TargetType="{x:Type Button}" BasedOn="{x:Null}">         
      <Setter Property="FocusVisualStyle" Value="{DynamicResource MyButtonFocusVisual}"/>       
      <Setter Property="Background" Value="{DynamicResource MyButtonBackgroundBrush}"/>       
      <Setter Property="Foreground" Value="{DynamicResource MyButtonForegroundBrush}"/>
      <Setter Property="BorderBrush" Value="{DynamicResource MyButtonBorderBrush}"/>
      <Setter Property="BorderThickness" Value="3"/>
      <Setter Property="FontFamily" Value="Segoe UI"/>      
      <Setter Property="FontSize" Value="14" />
      <Setter Property="CornerRadius" Value="2" />
      <Setter Property="Template">          
        <ControlTemplate TargetType="{x:Type Button}">
           <!-- We use Grid as a root because it is easy to add more elements to customize the button -->
           <Grid x:Name="Grid">
           <Border x:Name="Border" CornerRadius="{TemplateBinding CornerRadius}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}"/> 

Both and CornerRadius="{TemplateBinding CornerRadius}" give me the error "CornerRadius is not recognized or is not accessible".


You're trying to set/bind a CornerRadius property on class Button, but there is no such property. So the error is expected.

Need Your Help

h:commandLink not firing file download action without f:ajax

java jsf jsf-2 pdf-generation download

I have an h:datatable that contains a column with a link that will call the backing bean and "should" return a PDF document generated.