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

Programmatically logout in iOS application

ios ipad login uiviewcontroller logout

My iOS application contains login page. And after entering the app there is a logout button. When a user presses the logout button programmatically I want to show login page again as if the user is

Unit testing controllers in angularJS

angularjs unit-testing jasmine karma-runner karma-jasmine

I am having a hard time understanding unit tests in angularJs. I have just started with unit tests and the syntax seems weird to me. Below is the code for testing a controller :

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.