//File:Window.xaml.vb Imports System Imports System.Collections.Generic Imports System.Text Imports System.Windows Imports System.Windows.Controls Imports System.Windows.Data Imports System.Windows.Documents Imports System.Windows.Input Imports System.Windows.Media Imports System.Windows.Media.Imaging Imports System.Windows.Shapes Namespace Commands Public Partial Class CustomCommand Inherits System.Windows.Window Public Sub New() InitializeComponent() End Sub Private Sub MyCommand(sender As Object, e As ExecutedRoutedEventArgs) Console.WriteLine("Control R pressed") End Sub End Class Public Class DataCommands Shared my As RoutedUICommand Shared Sub New() Dim inputs As New InputGestureCollection() inputs.Add(New KeyGesture(Key.R, ModifierKeys.Control, "Ctrl+R")) my = New RoutedUICommand("Requery", "Requery", GetType(DataCommands), inputs) End Sub Public Shared ReadOnly Property MyCommand() As RoutedUICommand Get Return my End Get End Property End Class End Namespace