Fernando Sousa
Fernando Sousa

Reputation: 241

Change button size (XAML)

I'm trying to change the size of the button (XAML), making it larger (standard size: 20x12). When I put it higher, the button does not appear in full when I run the program:

enter image description here

<Button Name="generate"
            RelativePanel.Below="empty"
            RelativePanel.AlignHorizontalCenterWithPanel="True"
            Margin="0,45,0,0"
            x:Uid="GenerateButton"
            Content=""
            Click="generate_Click" 
            Width="40" Height="24"/>

Upvotes: 0

Views: 14780

Answers (1)

mm8
mm8

Reputation: 169360

If you set the Height of the Button to 24 you should also decrease the Padding to like 0 for the text to fit:

<Button Name="generate"
        RelativePanel.Below="empty"
        RelativePanel.AlignHorizontalCenterWithPanel="True"
        Margin="0,45,0,0"
        x:Uid="GenerateButton"
        Content=""
        Click="generate_Click" 
        Width="40" Height="24" Padding="0"/>

You may also want to set the MinWidth property to 40 rather than the Width property unless the text is very short.

Upvotes: 0

Related Questions