Failed to assign to property when adding new ApplicationBarMenuItem icon

application-bar, c#, shell, silverlight, windows-phone-7

Solution

The problem is in the event handler signature. You have `RoutedEventArgs` as the second parameter. It should just be `EventArgs`.

Here is an explanation. Don't forget that the app bar is a shell object.

Problem

I've added a new `ApplicationBarMenu` button with icon to a page in my wp7 project. when trying to run the page i get : Failed to assign to property 'Microsoft.Phone.Shell.ApplicationBarIconButton.Click'. [Line: 56 Position: 124] Which points to the new menu item button i have added (the second one, `send_report_button` ): ``` <phone:PhoneApplicationPage.ApplicationBar> <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True"> <shell:ApplicationBarIconButton x:Name="take_photo_button" IconUri="/Images/appbar.feature.camera.rest.png" Text="Take photo" Click="TakePhotoClick" /> <shell:ApplicationBarIconButton x:Name="send_report_button" IconUri="/Images/mail.sent.png" Text="Send report" Click="SendReportClick" /> <shell:ApplicationBarIconButton x:Name="logout_button" IconUri="/Images/appbar.logout.rest.png" Text="Logout"/> <shell:ApplicationBar.MenuItems> <!--<shell:ApplicationBarMenuItem x:Name="menuItem1" Text="MenuItem 1"/> <shell:ApplicationBarMenuItem x:Name="menuItem2" Text="MenuItem 2"/>--> </shell:ApplicationBar.MenuItems> </shell:ApplicationBar> </phone:PhoneApplicationPage.ApplicationBar> ``` I have checked ten times that i have a method in the `.xaml.cs` : ``` private void SendReportClick(object sender, RoutedEventArgs e) ``` But still, VS doesnt seem to recognize it, or something else is wrong. Thanks

Original source

Related problems