protected virtual ListViewDataItem GetUpperItem(ListViewDataItem currentItem) { ListViewTraverser enumerator = this.Scroller.Traverser.GetEnumerator() as ListViewTraverser; enumerator.Position = (object)currentItem; int num1 = 0; while (enumerator.MovePrevious() && enumerator.Current != null && !enumerator.Current.IsLastInRow) { num1 += this.GetItemFlowOffset(enumerator.Current); } if (!(currentItem is ListViewDataItemGroup) && currentItem != null) { num1 += this.GetItemFlowOffset(currentItem) / 2; } if (enumerator.Position == null) { return((ListViewDataItem)null); } do { ; }while (enumerator.MovePrevious() && enumerator.Current != null && !enumerator.Current.IsLastInRow); int num2 = 0; while (enumerator.MoveNext() && !enumerator.Current.IsLastInRow && num2 + this.GetItemFlowOffset(enumerator.Current) < num1) { num2 += this.GetItemFlowOffset(enumerator.Current); } return(enumerator.Current); }
public bool Remove(ListViewDataItem item) { ListViewTraverser traverser = this.owner.ViewElement.Scroller.Traverser.GetEnumerator() as ListViewTraverser; traverser.Position = item; if (traverser.MovePrevious() && traverser.Current != null && traverser.Current != item) { this.owner.SelectedItem = traverser.Current; } else { traverser.Position = item; if (traverser.MoveNext() && traverser.Current != item) { this.owner.SelectedItem = traverser.Current; } else { this.owner.SelectedItem = null; } } bool result = this.owner.ListSource.Remove(item); item.Owner = null; this.owner.SelectedItems.ProcessSelectedItem(item); return(result); }
protected virtual ListViewDataItem GetUpperItem(ListViewDataItem currentItem) { ListViewTraverser enumerator = this.Scroller.Traverser.GetEnumerator() as ListViewTraverser; enumerator.Position = currentItem; int currentItemX = 0; while (enumerator.MovePrevious() && enumerator.Current != null && !enumerator.Current.IsLastInRow) { currentItemX += enumerator.Current.ActualSize.Width; } if (!(currentItem is ListViewDataItemGroup) && currentItem != null) { currentItemX += currentItem.ActualSize.Width / 2; } if (enumerator.Position == null) { return(null); } while (enumerator.MovePrevious() && enumerator.Current != null && !enumerator.Current.IsLastInRow) { } int x = 0; while (enumerator.MoveNext() && !enumerator.Current.IsLastInRow) { if (x + enumerator.Current.ActualSize.Width >= currentItemX) { return(enumerator.Current); } x += enumerator.Current.ActualSize.Width; } return(enumerator.Current); }
/// <summary> /// Gets the previous visible item of a given <see cref="ListViewDataItem"/>. /// </summary> /// <param name="currentItem">The current item.</param> /// <returns>The previous item.</returns> protected virtual ListViewDataItem GetPreviousItem(ListViewDataItem currentItem) { ListViewTraverser enumerator = this.Scroller.Traverser.GetEnumerator() as ListViewTraverser; enumerator.Position = currentItem; if (enumerator.MovePrevious()) { return(enumerator.Current); } else { return(null); } }
public bool Remove(ListViewDataItem item) { ListViewTraverser enumerator = this.owner.ViewElement.Scroller.Traverser.GetEnumerator() as ListViewTraverser; enumerator.Position = (object)item; if (enumerator.MovePrevious() && enumerator.Current != null && enumerator.Current != item) { this.owner.SelectedItem = enumerator.Current; } else { enumerator.Position = (object)item; this.owner.SelectedItem = !enumerator.MoveNext() || enumerator.Current == item ? (ListViewDataItem)null : enumerator.Current; } bool flag = this.owner.ListSource.Remove(item); item.Owner = (RadListViewElement)null; this.owner.SelectedItems.ProcessSelectedItem(item); this.owner.CheckedItems.ProcessCheckedItem(item); return(flag); }