BindableApplicationBar & NavigateToPageAction

Nov 16, 2012 at 5:46 PM
Hi, 
Using MVVM Navigate to page action doesn't work under BindableApplicationBar:
        <bar:BindableApplicationBar x:Name="MainPageAppBar" BindableOpacity="1.0" IsVisible="True">
            <bar:BindableApplicationBar.MenuItems>
                <bar:BindableApplicationBarMenuItem  Text="Settings">
                    <ic:Interaction.Triggers>
                        <ic:EventTrigger EventName="Click">
                            <ec:NavigateToPageAction TargetPage="/View/SettingsPage.xaml"/>
                        </ic:EventTrigger>
                    </ic:Interaction.Triggers>
                </bar:BindableApplicationBarMenuItem>
            </bar:BindableApplicationBar.MenuItems>
        </bar:BindableApplicationBar>
    </bar:Bindable.ApplicationBar>

The same works using the Phone7.fx BindableApplicationBar:

<Phone7_Fx_Controls:BindableApplicationBar x:Name="MainPageAppBar" BarOpacity="1.0" IsVisible="True">
  <Phone7_Fx_Controls:BindableApplicationBar.MenuItems>
    <Phone7_Fx_Controls:BindableApplicationBarMenuItem  Text="Settings">
      <ic:Interaction.Triggers>
        <ic:EventTrigger EventName="Click">
          <ec:NavigateToPageAction TargetPage="/View/SettingsPage.xaml"/>
        </ic:EventTrigger>
      </ic:Interaction.Triggers>
  </Phone7_Fx_Controls:BindableApplicationBarMenuItem>
</Phone7_Fx_Controls:BindableApplicationBar>

 Thanks,

 

Tomer

 

Coordinator
Nov 16, 2012 at 5:53 PM

Not sure why you would want to use a bindable appbar wrappers and then use even more wrappers to get back to supporting clicks. You should use command bindings instead. Alternatively - I think with my implementation you should be able to use the regular app bar as well as my wrappers so you could define that menu item with click support in the regular app bar and do anything you want bindable in the wrapper. Third option is to take the source code from here and update it - add a click event to the BindableApplicationBarMenuItem class raised when the wrapped button gets clicked.

Nov 16, 2012 at 8:32 PM
Edited Nov 16, 2012 at 8:33 PM

The intention is to have the navigation in xaml if possible.

Can you elaborate more on the second option? How can bindableapplicationbar can be interleaved with the regular application bar?

 

Coordinator
Nov 16, 2012 at 8:35 PM

You should be able to use both regular ApplicationBar AND the BindableApplicationBar in the same page and the icon buttons and menuitems should get merged.