I recently uncommented the code that is there (commented out by default) which allows you to display and application bar in your Win7 Mobile applications:
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
<shell:ApplicationBarIconButton IconUri="/Images/button1.png" Text="Button 1"/>
<shell:ApplicationBarIconButton IconUri="/Images/button2.png" Text="Button 2"/>
<shell:ApplicationBar.MenuItems>
<shell:ApplicationBarMenuItem Text="Menu Item 1"/>
<shell:ApplicationBarMenuItem Text="Menu Item 2"/>
<shell:ApplicationBarMenuItem Text="Menu Item 3"/>
<shell:ApplicationBarMenuItem Text="Menu Item 4"/>
</shell:ApplicationBar.MenuItems>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
However, when I ran the application I got the infamous error: AG_E_PARSER_BAD_PROPERTY_VALUE
The problem was I had taken the event callbacks from my buttons in the main grid and moved them to the buttons in the application bar. These event signatures are different though and as a result you will get the error stated above. Notice the difference below, one uses EventArgs the other uses RoutedEventArgs.
Button event signature from main grid:
private void Button_Click(object sender, RoutedEventArgs e)
{
}
Button event signature from application bar:
private void Button_Click(object sender, EventArgs e)
{
}
Thanks,
–Mike






