private void UpdateItems(SharingSpaceView item) { var index = Items.IndexOf(item); Items.Remove(item); Items.Insert(index, item); }
public SharingSpace HideOrShowProduct(SharingSpaceView item) { if (_oldItem == item) { // click twice on the same item will hide it item.IsVisible = !item.IsVisible; UpdateItems(item); } else { if (_oldItem != null) { // hide previous selected item _oldItem.IsVisible = false; UpdateItems(_oldItem); } // show selected item item.IsVisible = true; UpdateItems(item); } _oldItem = item; // save sharing space id if (item.IsVisible) { return new SharingSpace { Id = item.Id, CreatedAt = item.CreatedAt, CreationDate = item.CreationDate, CreationLocation = item.CreationLocation, UserId = item.UserId, Descriptor = item.Descriptor, UpdatedAt = item.UpdatedAt, Version = item.Version } } ; else { return(null); } }