目前我有以下命令類:WPF命令類重寫CanExecuteChanged-Event?
Public Class SubscribeCommand
Implements ICommand
Private ReadOnly _vm As MainWindowViewModel
Public Sub New(ByVal vm As MainWindowViewModel)
_vm = vm
End Sub
Public Function CanExecute(ByVal parameter As Object) As Boolean Implements System.Windows.Input.ICommand.CanExecute
Return Not String.IsNullOrEmpty(_vm.Symbol)
End Function
Public Event CanExecuteChanged(ByVal sender As Object, ByVal e As System.EventArgs) Implements System.Windows.Input.ICommand.CanExecuteChanged
Public Sub Execute(ByVal parameter As Object) Implements System.Windows.Input.ICommand.Execute
_vm.Subscribe()
End Sub
End Class
在教程中,我看,你必須實現加{}並去除{}爲canExecuteChanged的事件。但我怎麼能做到這一點,與VB.NET?
非常感謝..
不知道我很想念這裏,但我的項目,當我使用這個代碼它不編譯。說調用RaiseEvent代替。 – TWood 2013-09-19 20:03:35