Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you make a fully square button?

Tags:

c#

button

wpf

Is there a simple way to make a fully square Button? Normally, a Button is a little rounded, so how do I achieve this?

like image 842
Phu Minh Pham Avatar asked Aug 29 '26 22:08

Phu Minh Pham


1 Answers

Just create a custom button style...something like this

 <Style x:Key="ButtonStyle" TargetType="Button">
    <Setter Property="FontFamily"
            Value="Arial Narrow" />
    <Setter Property="FontSize"
            Value="13" />
    <Setter Property="Width" Value="50"/>
    <Setter Property="Height" Value="20"/>
    <Setter Property="Margin" Value="3"/>
    <Setter Property="Cursor" Value="Hand"/>
    <Setter Property="BorderBrush" Value="#FF1733D2"/>
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="HorizontalAlignment" Value="Left"/>
    <Setter Property="VerticalAlignment" Value="Top"/>
    <Setter Property="Foreground" Value="White"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="Button">
                <Border x:Name="Border" Background="#FF1733D2">
                    <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" />
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

If you have Blend click on the button... edit style -> edit current... and get rid of the corner radius I think

like image 177
Ivan Crojach Karačić Avatar answered Aug 31 '26 15:08

Ivan Crojach Karačić



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!