When you are building out a WinRT/Metro application using C#/XAML you have the ability to add an ApplicationBar (part of the Windows.UI.Xaml.Controls namespace) to your application as seen below
When you adding a Application bar you can have it dock to the top or bottom. When having it dock to the bottom you will want to make sure it is actually on the bottom. For example, given the XAML below you may expect that the ApplicationBar would actually be at the bottom of the screen.
However, as you can see from the screen shot the blue bar is actually towards the top.
The reason for this is because my page has a <Grid> in it with multiple rows and because I did not explicit set the grid the ApplicationBar should be placed in it defaulted to the first row (XAML Convention).
From here I have 2 options
- Explicitly set the grid row my ApplicationBar should be assigned to
- Create a wrapper grid which contains your content grid along with any ApplicationBars
Personally I prefer option 2 because in my experience the number of rows will change over time and you may forget to update the Grid.Row setting in your ApplicationBar control.
Here is my final XAML in which I create the inner and outer <Grid> for my content and my app bars
And when I run the code above I get:
The moral of the post is this. If your ApplicationBar is not in the location you would expect it make sure it is not placed inside a grid row or some other control which is changing its location.
Till next time,
10-30-2011 8:24 AM