Categories > Coding > C# >

WPF CornerRadius Button

Posts: 326

Threads: 18

Joined: Nov, 2021

Reputation: 39

Posted

So someone in discord was confused how to add cornerradius to buttons in wpf, so I quickly made this style for him. I wondered why not upload it on WRD so there you go to whoever needs this.

 

 <Style x:Key="CornerRadiusButton"
           TargetType="Button">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Button">

                            <Border Name="border"
                            Padding="4 2"
                            Background="{TemplateBinding Background}"
                            CornerRadius="20">
                                <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
                            </Border>

                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
  • 0

Method

Contributor

Posts: 79

Threads: 7

Joined: Mar, 2023

Reputation: 3

Replied

If you can't learn how to add a CornerRadius to a button, you don't need to be developing anything in WPF.

Comments

RealRealNik 39 Reputation

Commented

Thats wrong, custom styles can be a bit tricky while starting out.

  • 0

Method 3 Reputation

Commented

@RealRealNik, It's not wrong. If they can't learn how to do it theirselves and they need to paste simple XAML, maybe they shouldn't do XAML. If someone's having trouble instead of attempting to paste, maybe they should try to read documentation or watch tutorials.

 

  • 0

Added

@JJSploit_On_Top, I believe you misunderstood what I'm saying. My point is, why make stuff for people when you can teach them.

  • 0

Murz 28 Reputation

Commented

Hmm... I may or may not be misunderstanding your point here. However, I would like to respectfully disagree.

 

I think that anyone can develop in WPF no matter their skill level! I think designing is very opinionated and everyone should be able to enjoy it if they enjoy what they make. I also think this is very helpful for people new to XML or whatever language it is. I think a lot of people would actually learn from this if they are serious about their designing skills.

  • 1

Pluto_Guy 29 Reputation

Commented

You can still learn from sources without teaching them. I actually learnt from a few sources myself. I disagree with what you are saying.

  • 1

  • 0

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )