public virtual void Update() { this.sizeMode = (PageViewItemSizeMode) this.itemLayout.GetValue(RadPageViewElement.ItemSizeModeProperty); this.contentOrientation = (PageViewContentOrientation) this.itemLayout.GetValue(RadPageViewElement.ItemContentOrientationProperty); this.itemSpacing = (int) this.itemLayout.GetValue(RadPageViewElement.ItemSpacingProperty); this.vertical = this.GetIsVertical(); this.availableLength = this.vertical ? this.availableSize.Height : this.availableSize.Width; this.paddingLength = this.vertical ? (float) this.itemLayout.Padding.Vertical : (float) this.itemLayout.Padding.Horizontal; Padding borderThickness = LightVisualElement.GetBorderThickness(this.itemLayout, true); this.borderLength = this.vertical ? (float) borderThickness.Vertical : (float) borderThickness.Horizontal; int num = 0; foreach (RadElement child in this.itemLayout.Children) { RadPageViewItem radPageViewItem = child as RadPageViewItem; if (radPageViewItem != null && radPageViewItem.Visibility != ElementVisibility.Collapsed) { radPageViewItem.Measure(this.GetMeasureSizeConstraint((RadItem) radPageViewItem)); PageViewItemSizeInfo itemSizeInfo = this.CreateItemSizeInfo(radPageViewItem); itemSizeInfo.desiredSize = new SizeF(radPageViewItem.DesiredSize.Width, radPageViewItem.DesiredSize.Height); this.maxWidth = Math.Max(itemSizeInfo.desiredSize.Width, this.maxWidth); this.maxHeight = Math.Max(itemSizeInfo.desiredSize.Height, this.maxHeight); this.items.Add(itemSizeInfo); itemSizeInfo.itemIndex = num++; } } this.itemCount = this.items.Count; }
public virtual void Update() { this.sizeMode = (PageViewItemSizeMode)this.itemLayout.GetValue(RadPageViewElement.ItemSizeModeProperty); this.contentOrientation = (PageViewContentOrientation)this.itemLayout.GetValue(RadPageViewElement.ItemContentOrientationProperty); this.itemSpacing = (int)this.itemLayout.GetValue(RadPageViewElement.ItemSpacingProperty); this.vertical = this.GetIsVertical(); this.availableLength = this.vertical ? this.availableSize.Height : this.availableSize.Width; this.paddingLength = this.vertical ? this.itemLayout.Padding.Vertical : this.itemLayout.Padding.Horizontal; Padding border = this.itemLayout.GetBorderThickness(true); this.borderLength = this.vertical ? border.Vertical : border.Horizontal; int itemIndexCounter = 0; foreach (RadElement element in this.itemLayout.Children) { RadPageViewItem item = element as RadPageViewItem; if (item == null) { continue; } if (item.Visibility == ElementVisibility.Collapsed) { continue; } //TODO: Optimization - cache desired size per item and measure only when a layout property is changed item.Measure(this.GetMeasureSizeConstraint(item)); PageViewItemSizeInfo itemSizeInfo = this.CreateItemSizeInfo(item); this.maxWidth = Math.Max(itemSizeInfo.desiredSize.Width, this.maxWidth); this.maxHeight = Math.Max(itemSizeInfo.desiredSize.Height, this.maxHeight); this.items.Add(itemSizeInfo); itemSizeInfo.itemIndex = itemIndexCounter++; } this.itemCount = this.items.Count; }