I can't get the ApplicationBarIconButton's click event to fire under certain conditions.
I tried to simplify the steps required to reproduce it:
1) Create a new Windows Phone Application
2) Add a new Page (Page1.xaml)
3) Add a simple button on MainPage.xaml launching a PhotoChooserTask and navigate to Page1.xaml on the Completed event
public partial class MainPage : PhoneApplicationPage
{
PhotoChooserTask photo;
public MainPage()
{
InitializeComponent();
photo = new PhotoChooserTask();
photo.Completed += OnCameraCaptureTaskCompleted;
}
void OnCameraCaptureTaskCompleted(object sender, PhotoResult args)
{
this.NavigationService.Navigate(new Uri("/Page1.xaml", UriKind.Relative));
}
private void button1_Click(object sender, RoutedEventArgs e)
{
photo.Show();
}
}
6) Uncomment the ApplicationBar section of Page1.xaml and set the click event of one of the buttons to a new event handler
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True">
<shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Won't work" Click="ApplicationBarIconButton_Click" />
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
private void ApplicationBarIconButton_Click(object sender, EventArgs e)
{
MessageBox.Show("This messagebox won't show!");
}
Launch it
Click on the button to select a picture => you are redirected to Page1.xaml
Click on the ApplicationBarIconButton button : the event isn't fired!
Did I miss something or that's a bug?