internal void BringIntoViewCore(BringIntoViewOperation bringIntoViewOperation) { if (bringIntoViewOperation == null) { return; } if (bringIntoViewOperation.ScrollAttempts < BringIntoViewOperation.MaxScrollAttempts) { if (this.IsItemInViewport(bringIntoViewOperation.RequestedItem, false)) { if (bringIntoViewOperation.CompletedAction != null) { bringIntoViewOperation.CompletedAction.Invoke(); } } else { this.BringIntoView(bringIntoViewOperation); bringIntoViewOperation.ScrollAttempts++; this.scrollUpdateService.RegisterUpdate(new DelegateUpdate(() => BringIntoViewCore(bringIntoViewOperation))); } } else { this.UnsubscribeRendering(); } }
public virtual void BringIntoView(object item, Action scrollCompletedAction) { if (!this.IsProperlyTemplated) { this.initialVirtualizationItem = this.listSource.FindItem(item); return; } var bringIntoViewOperation = new BringIntoViewOperation(item) { CompletedAction = scrollCompletedAction }; this.BringIntoViewCore(bringIntoViewOperation); }
internal virtual void BringIntoView(BringIntoViewOperation bringIntoViewOperation) { ////Check whether the item to bring into view is already realized RadVirtualizingDataControlItem foundItem = null; foreach (RadVirtualizingDataControlItem uiItem in this.realizedItems) { if (object.Equals(uiItem.associatedDataItem.Value, bringIntoViewOperation.RequestedItem)) { foundItem = uiItem; break; } } ////If the item is not realized, recycle all items and start realizing from the pivot item (the one we should bring into view). if (foundItem == null) { this.initialVirtualizationItem = this.listSource.FindItem(bringIntoViewOperation.RequestedItem); if (this.initialVirtualizationItem == null) { throw new ArgumentException("Specified item does not exist in the Items Source."); } this.RecycleAllItems(); this.ApplyScrollOffsetForItem(this.initialVirtualizationItem); this.BeginAsyncBalance(); } else { ////If the item is realized, calculate the smallest amount that the item can be offset so that it is fully visible in the viewport. double offset = this.GetRealizedItemBringIntoViewOffset(foundItem); this.virtualizationStrategy.ScrollToOffset(this.virtualizationStrategy.ScrollOffset + offset, () => { ////Perform a balance to ensure that all buffers are filled. this.SubscribeRendering(); this.BalanceVisualSpace(); }); } }