0

I just don't understand why my code doesn't work. And I just want to change only one Button's border, I have seen someone using TargetType="{x:Type Button}",It doesn't meet my demand! And the answer in Set CornerRadius on button template explains how to change the CornerRadius, I know how to change the CornerRadius, but I really don't know why my Code doesn't work for only one button.

<Button Content="OK" BorderThickness="1">
    <Button.Resources>
        <Style TargetType="{x:Type Border}">
            <Setter Property="CornerRadius" Value="10"/>
        </Style>
    </Button.Resources>
</Button>
Community
  • 1
  • 1
Grey
  • 45
  • 8
  • 3
    Possible duplicate of [Set CornerRadius on button template](http://stackoverflow.com/questions/17681022/set-cornerradius-on-button-template) – Harsha W Apr 27 '17 at 03:45
  • I see many typing mistakes in your code. Is that the reason? I corrected all of them and code is working fine at my end. – Naresh Ravlani Apr 27 '17 at 05:17
  • Your current code will work only if `Border` is present in `Button.Content`, and not in its `Template`. – AnjumSKhan Apr 27 '17 at 05:22
  • @NareshRavlani sorry about my typing mistakes. The corrected code is working fine, but the CornerRadius of my Button isn't changed – Grey Apr 29 '17 at 01:24
  • @AnjumSKhan I somewhat knows how to fix it... – Grey Apr 29 '17 at 02:15
  • @Grey: Then some other code is causing that issue as provided code is working fine for different corner radius at my end. – Naresh Ravlani Apr 29 '17 at 06:26

1 Answers1

0

It seems that you are a novice, i suggest you detach the Button in Blend to learn how to change the border

Alpha
  • 668
  • 6
  • 11