I'm trying to add an Xamarin.Forms TapGestureRecognizer onto a stacklayout in code behind in VB.
I've Converted this code from an Xamarin example here:
xxxx://github.com/xamarin/xamarin-forms-samples/blob/master/Xuzzle/Xuzzle/Xuzzle/XuzzlePage.cs
`TapGestureRecognizer tapGestureRecognizer = new TapGestureRecognizer {
Command = new Command (OnSquareTapped),
CommandParameter = square
};
square.GestureRecognizers.Add (tapGestureRecognizer);
async void OnSquareTapped (object parameter)
{
//do something
}`
When I convert to VB, I get the following code.
`Private tapGestureRecognizer As TapGestureRecognizer = New
TapGestureRecognizer With {.Command = New Command(OnSquareTapped),
.CommandParameter = square}
Private Async Sub OnSquareTapped(ByVal parameter As Object)
//do something
End Sub`
'Argument not specified for parameter'
Then when I add a parameter I get
'Expression does not produce a value'
If I change OnSquareTapped to a Function I get
'the Overload resolution failed...'
I can't find a working example anywhere in VB and a lot of the C# examples either use depreciated methods or Lamda, which I'm not familiar with.
Can anyone provide a working VB example - with an explanation as to where I'm going wrong?