Categories > Coding > C# >

WPF CornerRadius Button

RealRealNik

type !larry in chat ;)

vip

Posts: 431

Threads: 23

Joined: Nov, 2021

Reputation: 43

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

https://media.discordapp.net/attachments/1067168861343989910/1099371568062267503/WRDBanner_RealRealNikkk.png

 

Siggy made by B00M :D

Method

Contributor

Posts: 116

Threads: 12

Joined: Mar, 2023

Reputation: 5

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 43 Reputation

Commented

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

  • 0

Method 5 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

JJSploit_On_Top 43 Reputation

Commented

You are forgetting the fact people can also learn from open sources. People learn in all kinds of ways, people should be perfectly fine with viewing different learning resources if it helps them understand certain things better. People can also paste stuff from a youtube tutorial if they wanted to.

  • 0

Method 5 Reputation

Commented

@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

JJSploit_On_Top 43 Reputation

Commented

Oh my bad I misunderstood what your point was.

  • 1

  • 0

Users viewing this thread:

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