添加新的ApplicationBarMenuItem图标时无法分配给属性

Mic*_*ael 3 c# silverlight shell windows-phone-7 application-bar

ApplicationBarMenu在wp7项目中为页面添加了一个带图标的新按钮.当我试图运行页面时,我得到:

无法分配给属性'Microsoft.Phone.Shell.ApplicationBarIconButton.Click'.[行:56位置:124]

哪个指向我添加的新菜单项按钮(第二个,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>
Run Code Online (Sandbox Code Playgroud)

我检查了十次,我有一个方法.xaml.cs:

private void SendReportClick(object sender, RoutedEventArgs e)
Run Code Online (Sandbox Code Playgroud)

但是,VS似乎并没有认识到它,或者其他什么是错的.

谢谢

Den*_*sky 10

问题出在事件处理程序签名中.你有RoutedEventArgs第二个参数.它应该是EventArgs.

这是一个解释.不要忘记应用栏是一个shell对象.