/// <summary> /// Executes the command /// </summary> /// /// <param name="parameter"> /// The input from 'CommandParameter' /// </param> public void Execute(object parameter) { Shelf shelf = (parameter as Shelf); Shelf newShelf = (shelf.Clone() as Shelf); bool isValid = false; switch (shelf.ShelfTypeName) { case "Fixed": shelfTypeName = "Adjustable"; isValid = true; break; case "Corner (Fixed)": shelfTypeName = "Corner (Adj)"; isValid = true; break; } if (isValid) { foreach (var shelfType in viewmodel.ShelfTypes) { if (shelfType.Name == shelfTypeName) { newShelf.ShelfTypeName = shelfTypeName; viewmodel.Add(newShelf); } } } }