I'm using a version of the common RelayCommand class and trying to pass a command parameter but not having success. I get the following error:
Error 29 Method 'Private Sub KeyPadPressExecute(param As Object)' does not have a signature compatible with delegate 'Delegate Sub Action()'.
I've looked at the many examples of using parameters with commands, but I can't make sense out of them. I don't understand where I'm supposed to get the parameter from that will be passed on to KeyPadPressExecute().
Here's the relevant code:
Private Sub KeyPadPressExecute(param As Object)
Debug.Print(param.ToString)
End Sub
Private Function CanKeyPadPressExecute() As Boolean
Return True
End Function
Public ReadOnly Property KeyPadPress() As ICommand
Get 'Error occurs on next line
Return New RelayCommand(AddressOf KeyPadPressExecute, AddressOf CanKeyPadPressExecute)
End Get
End Property
What my XAML looks like:
<Button Command="{Binding KeyPadPress}" CommandParameter="1" Width="84"></Button>
I'm using VS 2012 and targeting .NET 4.5.
Note: My original post said I was using MicroMVVM. Closer inspect of the project indicates that the assembly named MicroMVVM is not related to the MicroMVVM framework hosted at codeplex. This project was started by someone else, thus the confusion.
Return New RelayCommand(Of String)(AddressOf KeyPadPressExecute...and now it's working.