

Public Class RelayCommand
    Implements ICommand
    Private _execute As Action(Of String)
    Private _canExecute As Func(Of Object, Boolean)

    Public Sub New(execute As Action(Of String))
        _execute = execute
    End Sub

    Public Event CanExecuteChanged As EventHandler Implements ICommand.CanExecuteChanged

    Public Function CanExecute(parameter As Object) As Boolean Implements ICommand.CanExecute
        Return True
    End Function

    Public Sub Execute(parameter As Object) Implements ICommand.Execute
        _execute(TryCast(parameter, String))
    End Sub
End Class