Daniel Jones
Daniel Jones

Reputation: 109

Expand borders on xaml app?

My xaml application is not filling up my screen when I debug it. As you can see my buttons are displayed at the bottom. enter image description here

After debugging the app the buttons are now half way up. enter image description here This is the positions that xaml has set as default, both are at auto auto.

enter image description here

Upvotes: 0

Views: 76

Answers (2)

nocturns2
nocturns2

Reputation: 661

If your buttons are in a stack panel, you can lock (anchor) the stack panel to the bottom of your LayoutRoot and set the height of the stack panel to a height close to the height of your buttons. Then, I would look at setting the LayoutRoot width and height to auto.

You can also configure your grid with rows and cols along with their dimensions.

try this xaml:

<Grid>
    <StackPanel HorizontalAlignment="Center" Margin="0,278,0,0" Width="517" Orientation="Horizontal" Height="50" VerticalAlignment="Bottom">
        <Button Content="Button"/>
        <Button Content="Button"/>
    </StackPanel>

</Grid>

On your grid you'll see little locks positioned at the center of ever side of the grid. If you add an object and move your mouse along the locks your cursor changes to a hand pointing a finger icon. If you click on the lock at that point, you'll see the lock either locks or unlocks. (i.e. you'll see a larger gap between the lock lines). It helps maintain the anchor position of the object when resizing the screen.

This is a screenshot with the stack panel selected. Notice that only the bottom anchor is locked.

Screenshot of stack panel selected with anchor locks

Upvotes: 1

Jwosty
Jwosty

Reputation: 3644

Instead of using Auto, use Bottom for both.

Upvotes: 1

Related Questions