public static GlobalCommand <T> GetInstance(Action <T> execute, Predicate <T> canExecute)
 {
     lock (locker)
     {
         if (_globalCommand == null)
         {
             _globalCommand = new GlobalCommand <T>(execute, canExecute);
         }
     }
     return(_globalCommand);
 }
        public ViewModel()
        {
            Categories = new ObservableCollection <Category>()
            {
                new Category()
                {
                    Id = 1, Name = "Cat1", Description = "This is Cat1 Desc"
                },
                new Category()
                {
                    Id = 1, Name = "Cat2", Description = "This is Cat2 Desc"
                },
                new Category()
                {
                    Id = 1, Name = "Cat3", Description = "This is Cat3 Desc"
                },
                new Category()
                {
                    Id = 1, Name = "Cat4", Description = "This is Cat4 Desc"
                }
            };

            this.AddRowCommand = GlobalCommand <object> .GetInstance(ExecuteAddRowCommand, CanExecuteAddRowCommand);
        }
 private void Delete_Click(object sender, RoutedEventArgs e)
 {
     GlobalCommand <object> .GetInstance(null).Execute(null);  // I'm not quite happy with this but it works
 }