开发者

ApplicationBar Working Different in Windows Phone 7 Beta Than CTP

There are a few issues I notice with the beta version of the WP7 tools:

  • The ApplicationBar no longer causes a page to resize it contents with the CTP workaround
  • Using the ApplicationBar from App.xaml and imported as a static resource does not work as expected

In the CTP version of the WP7 tools when using an appbar and navigation from page to page, the appbar remainined on top of the page content rather than having the content resize itself to be on top of the appbar. The work around was to set the IsVisible property to false in the constructor and set to true on the page loaded event. This is no longer working and the appbar remains on top of the loaded page unless turned completely off. I have my appbar xaml in app.xaml and each page uses it as a static resource.

Also the click event is no longer triggered for app buttons, I am using the appbar as a resource in my App.xaml and added as a {StaticResource} in my page's xaml. Any help would be appreciated as this is the only way I have for navigating around my application, aside from rolling my own navigation page.

public CalculatorView()
{
    InitializeComponent();

    ApplicationBar.IsVisible = false;

    SupportedOrientations = SupportedPageOrientation.Portrait;

    Application.Current.RootVisual = this;
}

private void PhoneApplicationPageLoaded(object sender, RoutedEventArgs e)
{
    ApplicationBar.IsVisible = true;
}

AppBar XAML:

<Shell:ApplicationBar x:Key="GlobalApplicationBar" IsVisible="True" IsMenuEnabled="True">
    <Shell:ApplicationBar.Buttons>
        <Shell:ApplicationBarIconButton x:Name="CalculaterAppIconButton" Click="CalculaterMenuItemClick" IconUri="/Images/Icons/32/Back.png" Text="Main" />
        <Shell:ApplicationBarIconButton x:Name="HistoryAppIconButton" Click="HistoryMenuItemClick" IconUri="/Images/Icons/32/Intl-History.png" Text="History" />
        <Shell:ApplicationBarIconButt开发者_开发问答on x:Name="StatisticsAppIconButton" Click="StatisticsMenuItemClick" IconUri="/Images/Icons/32/Stats.png" Text="Stats" />
        <Shell:ApplicationBarIconButton x:Name="OptionsAppIconButton" Click="OptionsMenuItemClick" IconUri="/Images/Icons/32/Settings.png" Text="Options" />
    </Shell:ApplicationBar.Buttons>
    <Shell:ApplicationBar.MenuItems>
        <Shell:ApplicationBarMenuItem x:Name="StartingHandsMenuItem" Click="StartingHandsMenuItemClick" Text="Starting Hands" />
        <Shell:ApplicationBarMenuItem x:Name="HoleOddsMenuItem" Click="HoleOddsMenuItemClick" Text="Hole Odds" />
    </Shell:ApplicationBar.MenuItems>
</Shell:ApplicationBar> 

AppBar in Phone Application Page:

ApplicationBar="{StaticResource GlobalApplicationBar}"   //In my page.xaml


Putting aside the fact you are refering to perceived differences between the Beta and CTP versions of the tools.
The ApplicationBar appear over the top of the page content based on it's opacity:

If the opacity is set to 1, the displayed page will be resized to be the area of the screen not covered by the Application Bar.

from MSDN

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜