I'm trying to add a handler to MouseLeftButtonUp
of my dynamically created Label (System.Windows.Controls.Label) but I'm getting an error message
Argument not specified for parameter 'e' of 'Private Sub btnLink_Clicked(sender As Object, e As MouseButtonEventArgs)
Private Sub CreateClickableLabel()
Dim btnLink As New System.Windows.Controls.Label()
btnLink.Content = "Click Me"
AddHandler btnLink.MouseLeftButtonUp, btnLink_Clicked
Windows.Controls.Grid.SetColumn(btnLink, 0)
Windows.Controls.Grid.SetRow(btnLink, 0)
gridData.Children.Add(btnLink)
End Sub
Private Sub btnLink_Clicked(ByVal sender As Object, ByVal e As MouseButtonEventArgs)
MessageBox.Show("You clicked me")
End Sub
How can I add this event Handler programmatically to my Labels? once I'll have more labels being handled by the same function?