internal override void RefreshRenderInfo(bool force) { if (force || (this.renderInfo != null && this.VisibleLineCount != this.renderInfo.Count)) { this.renderInfo = null; } }
public EditRowPool(IUIContainerGenerator <GridEditRowModel, RowGenerationContext> generator, ITable tableBase) { this.generator = generator; this.table = tableBase; this.renderInfo = new IndexStorage(2); this.dummyElement = new KeyValuePair <int, List <GridRowModel> >(0, new List <GridRowModel> { new GridEditRowModel() }); }
internal override void RefreshRenderInfo(bool force) { if (force || (this.renderInfo != null && this.VisibleLineCount != this.renderInfo.Count)) { this.renderInfo = new IndexStorage(this.TotalSlotCount, IndexStorage.UnknownItemLength); } this.columnSlotsRenderInfo = null; this.paddingRenderInfo = null; if (this.AvailableOppositeLength > 0) { this.OnAvailableLengthChanged(this.AvailableOppositeLength, this.AvailableOppositeLength); } }
public CompactLayout(IHierarchyAdapter adapter, double defaultItemLength) { if (adapter == null) { throw new ArgumentNullException("adapter", "Adapter cannot be null."); } this.DefaultItemLength = defaultItemLength; this.hierarchyAdapter = adapter; this.averageItemLength = defaultItemLength; this.collapsedSlotsTable = new IndexToValueTable <bool>(); this.groupHeadersTable = new IndexToValueTable <GroupInfo>(); this.LayoutStrategies.Add(new ItemsLayoutStrategy()); this.renderInfo = new IndexStorage(this.TotalSlotCount, this.DefaultItemLength); }
private void OnAvailableLengthChanged(double oldValue, double newValue) { if (this.ItemsSource == null) { return; } int slotCount = 0; double currentColumnLength = 0; this.paddingRenderInfo = new IndexStorage(0); for (int i = 0; i < this.ColumnSlotsRenderInfo.Count; i++) { List <ItemInfo> items = new List <ItemInfo>(); var length = this.ColumnSlotsRenderInfo.ValueForIndex(i); if (this.TryGetGroupedItemsAtColumnSlot(slotCount, slotCount, i, ref items) && items.Count > 0 && items.Last().Item is IGroup) { if (currentColumnLength > 0) { var paddingValue = Math.Max(0, newValue - currentColumnLength); this.paddingRenderInfo.Add(paddingValue); currentColumnLength = 0; slotCount++; } this.ColumnSlotsRenderInfo.Update(i, newValue); this.paddingRenderInfo.Add(0); currentColumnLength = 0; slotCount++; continue; } else { if (currentColumnLength + length <= newValue) { currentColumnLength += length; } else { var paddingValue = Math.Max(0, newValue - currentColumnLength); this.paddingRenderInfo.Add(paddingValue); slotCount++; currentColumnLength = length; } } } if (this.LayoutStrategies.Where(c => c is PlaceholderStrategy).Any()) { if (currentColumnLength + this.DefaultItemOppositeLength > newValue) { slotCount++; currentColumnLength %= newValue; } } if (currentColumnLength > 0) { var paddingValue = Math.Max(0, newValue - currentColumnLength); this.paddingRenderInfo.Add(paddingValue); currentColumnLength = 0; slotCount++; } this.groupHeadersTable.Clear(); if (this.groupInfoTable != null) { this.groupInfoTable.Clear(); } int slotsCount = 0; int levels = this.GroupLevels; this.totalItemsCount = slotsCount; int totalLines = 0; foreach (var strategy in this.LayoutStrategies) { this.totalItemsCount += strategy.CalculateAppendedSlotsCount(this, 0, ref totalLines); } if (this.TotalSlotCount != slotCount) { // todo update this.TotalSlotCount = totalLines; this.VisibleLineCount = totalLines; // TODO find a better way to update this. this.renderInfo = new IndexStorage(this.TotalSlotCount, IndexStorage.UnknownItemLength); } }