Making a Button Fill the Cell Of a Grid

I'm trying to get a XAML Button to completely fill a cell in a Grid control.  I've set Padding and Margins to 0 and set alignment to Stretch but the button does not fill the cell completely.
LVL 1
DodsworthAsked:
Who is Participating?
 
DodsworthAuthor Commented:
Ah.. I'm developing for Windows Phone.  I just found out that the WP Button has a "touch-target overhang.", which prevents it from filling all the cell.

I used a Border and a StackPanel in the end.
0
 
David Johnson, CD, MVPOwnerCommented:
set the dimensions of the button and the cell to the same size
0
 
DodsworthAuthor Commented:
but my row and column defs are Width and Height ="*"
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Bob LearnedCommented:
How are the Grid and Button controls declared in the XAML?
0
 
aikimarkCommented:
are you coding in VB.Net or C#?
0
 
DodsworthAuthor Commented:
It's XAML.  No code behind...

<Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Button Content="Button" Grid.Column="0" Grid.Row="0"/>          

Open in new window

0
 
Bob LearnedCommented:
I don't see where you have set HorizontalAlignment and VerticalAlignment to "Stretch".
0
 
DodsworthAuthor Commented:
I took it out as it made no difference.
0
 
Bob LearnedCommented:
I took that XAML, and pasted it into a window, and it is stretched for me.

Button stretched in grid
0
 
Bob LearnedCommented:
Sometimes, it just comes down to the unknown factor...
0
 
DodsworthAuthor Commented:
solved
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.