AddHandler 是否需要参数?
我正在尝试添加一个处理程序,但是一旦我瞄准具有参数的方法,该处理程序就会失败。这是简单的代码:
AddHandler App.Current.RootVisual.MouseLeftButtonUp, RootVisual_MouseLeftButtonUp
Private Sub RootVisual_MouseLeftButtonUp(ByVal sender As Object, ByVal e As MouseButtonEventArgs)
End Sub
此错误不会让我构建。当查看示例时,我做得对。这是我得到的错误:
错误 3 未为“Private Sub”的参数“e”指定参数 RootVisual_MouseLeftButtonUp(发送者作为对象,e作为 System.Windows.Input.MouseButtonEventArgs)'。 C:\TFS\ProjectCollection\ItemManagementTool\ItemManagementTool.ClientApplication\Views\MainMenu.xaml.vb 82 70 ItemManagementTool.ClientApplication
对于“sender”参数,我收到类似的错误。 有什么想法吗?
I'm trying to add a handler, but as soon as I'm targetting a method that has parameters, the handler fails. This is the simple code:
AddHandler App.Current.RootVisual.MouseLeftButtonUp, RootVisual_MouseLeftButtonUp
Private Sub RootVisual_MouseLeftButtonUp(ByVal sender As Object, ByVal e As MouseButtonEventArgs)
End Sub
This error won't let me build. When looking at the examples, I'm doing it right. This is the error I get:
Error 3 Argument not specified for parameter 'e' of 'Private Sub
RootVisual_MouseLeftButtonUp(sender As Object, e As
System.Windows.Input.MouseButtonEventArgs)'. C:\TFS\ProjectCollection\ItemManagementTool\ItemManagementTool.ClientApplication\Views\MainMenu.xaml.vb 82 70 ItemManagementTool.ClientApplication
I get a similar error for the "sender" parameter.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您缺少
AddressOf
关键字You are missing the
AddressOf
keyword