public void MoveDown(FieldViewModel item) { if (item is null) { throw new ArgumentNullException(nameof(item)); } var index = Fields.IndexOf(item); if (index < 0) { return; } if (index == Fields.Count - 1) { return; } Fields.RemoveAt(index); Fields.Insert(index + 1, item); foreach (var field in Fields) { field.RefreshPosition(); } }
public void Delete(FieldViewModel item) { if (item is null) { throw new ArgumentNullException(nameof(item)); } Fields.Remove(item); }
public void Add(FieldViewModel item) { if (item is null) { throw new ArgumentNullException(nameof(item)); } Fields.Add(item); }
bool IContainer <FieldViewModel> .CanMoveDown(FieldViewModel item) { if (item is null) { throw new ArgumentNullException(nameof(item)); } var index = Fields.IndexOf(item); if (index < 0) { return(false); } return(index < Fields.Count - 1); }