public bool ChangeOrder(FaderItemViewModel item, OrderDirection dir) { int currentIndex = GetIndexOfItem(item); switch (dir) { case OrderDirection.Up: if (currentIndex > 0) { Colors.Move(currentIndex, currentIndex - 1); } else { return(false); } break; case OrderDirection.Down: if (currentIndex < Colors.Count - 1) { Colors.Move(currentIndex, currentIndex + 1); } else { return(false); } break; } RaisePropertyChanged(() => Colors); UpdateItems(); return(true); }
// private MvxCommand _removeCommand; // public IMvxCommand RemoveCommand{get{ return _removeCommand;}} public void Remove(FaderItemViewModel item) { Debug.WriteLine("remove " + item.Item); Colors.Remove(item); RaisePropertyChanged(() => Colors); UpdateItems(); }
// private MvxCommand _addColorCommand; // public IMvxCommand AddColorCommand{get{ return _addColorCommand;}} public void AddColor(Color color) { FaderItemViewModel item = new FaderItemViewModel(color, this); Colors.Add(item); RaisePropertyChanged(() => Colors); UpdateItems(); }
public int GetIndexOfItem(FaderItemViewModel item) { return(Colors.IndexOf(item)); }