private static void GenerateDecorator(int id, ItemInfo itemInfo, DecorationType decoratorElementType, DecorationPool <LineDecorationModel> decorationPool, Dictionary <int, LineDecorationModel> decorators, IDecorationPresenter <LineDecorationModel> owner) { LineDecorationModel decorator = null; if (owner != null && !decorators.TryGetValue(id, out decorator)) { decorator = CreateDecorator(itemInfo, decoratorElementType, decorationPool, owner); decorators.Add(id, decorator); } else if (owner != null) { decorator.ItemInfo = itemInfo; owner.ApplyDecoratorProperties(decorator, decoratorElementType); } }
private void ArrangeRowDecorations(ArrangeDataForDecorations horizontalArrangement, ArrangeDataForDecorations verticalArrangement) { double top; double bottom; double left; double right; foreach (var rowDecoratorPair in this.displayedRowDecorationsMap) { LineDecorationModel decorator = rowDecoratorPair.Value; LayoutInfo layoutInfo = decorator.ItemInfo.LayoutInfo; top = verticalArrangement.GetStartOfSlot(layoutInfo.Line); bottom = verticalArrangement.GetEndOfSlot(layoutInfo.Line + layoutInfo.LineSpan - 1); left = horizontalArrangement.GetStartOfLevel(layoutInfo.Level); right = layoutInfo.SpansThroughCells ? horizontalArrangement.SlotsEnd : horizontalArrangement.GetEndOfLevel(layoutInfo.Level + layoutInfo.LevelSpan - 1); var thickness = this.decorationPresenter.ArrangeDecorator(decorator, new RadRect(left, top, right, bottom)); } }
private static LineDecorationModel CreateDecorator(ItemInfo itemInfo, DecorationType decoratorElementType, DecorationPool <LineDecorationModel> displayData, IDecorationPresenter <LineDecorationModel> owner) { if (owner == null) { return(null); } var lineDecorator = displayData.GetRecycledElement(); if (lineDecorator == null) { lineDecorator = new LineDecorationModel(); lineDecorator.Container = owner.GenerateContainerForDecorator(); } lineDecorator.ItemInfo = itemInfo; owner.ApplyDecoratorProperties(lineDecorator, decoratorElementType); displayData.AddToDisplayedElements(lineDecorator); return(lineDecorator); }