internal override void OnOrientationChanged(Orientation newValue) { base.OnOrientationChanged(newValue); if (this.owner == null || !this.owner.IsTemplateApplied) { return; } if (this.owner.GetItemCount() > 0) { this.owner.StopAllAddedAnimations(); this.owner.StopAllRemovedAnimations(); IDataSourceItem firstViewportItem = this.GetTopVisibleContainer().associatedDataItem; while (this.owner.realizedItems.Count > 0) { RadDataBoundListBoxItem lastItem = this.owner.realizedItems[this.owner.realizedItems.Count - 1] as RadDataBoundListBoxItem; lastItem.SetVerticalOffset(0); lastItem.SetHorizontalOffset(0); this.owner.RecycleLastItem(); } this.owner.initialVirtualizationItem = firstViewportItem; this.owner.BeginAsyncBalance(); this.owner.BalanceVisualSpace(); } }
private void ReorderViewportItemsStartingAtRow(WrapRow row) { WrapRow parentRow = row; RadDataBoundListBoxItem processedItem = parentRow.firstItem as RadDataBoundListBoxItem; parentRow.lastItem = processedItem; processedItem.wrapRow = parentRow; parentRow.rowOffset = this.GetRowOffset(parentRow); double currentRowPosition = 0; while (true) { this.SetItemOffset(processedItem, parentRow.rowOffset); processedItem.wrapRow = parentRow; switch (this.orientationCache) { case Orientation.Horizontal: processedItem.SetHorizontalOffset(currentRowPosition); break; case Orientation.Vertical: processedItem.SetVerticalOffset(currentRowPosition); break; } currentRowPosition += this.GetItemExtent(processedItem); double itemLength = this.GetItemLength(processedItem); if (itemLength > parentRow.rowLength) { parentRow.rowLength = itemLength; } processedItem = processedItem.next as RadDataBoundListBoxItem; if (processedItem == null) { int wrapRowsCount = this.wrapRows.Count; this.OnRowFilled(parentRow, true); while (this.lastWrapRow != parentRow) { int indexOfRowToRemove = --wrapRowsCount; this.RemoveWrapRowAt(indexOfRowToRemove); } break; } else if (!this.CheckEnoughSpaceForItemInRow(parentRow, processedItem, true)) { parentRow.lastItem = processedItem.previous; currentRowPosition = 0; this.OnRowFilled(parentRow, false); if (parentRow.next == null) { parentRow = this.InsertWrapRowAt(this.wrapRows.Count); } else { parentRow = parentRow.next; } parentRow.rowOffset = this.GetRowOffset(parentRow); parentRow.firstItem = processedItem; parentRow.lastItem = processedItem; parentRow.rowLength = this.GetItemLength(processedItem); } else { parentRow.lastItem = processedItem; } } }