public static bool ExecuteCommand(this ICommandSource commandSource) { ICommand command = commandSource.Command; if (command == null) { return(false); } object parameter = commandSource.CommandParameter; IInputElement target = commandSource.GetTarget(); return(ExecuteCommand(command, parameter, target)); }