private void ApplyListSymbolPosition() { if (symbolRenderer != null) { ListSymbolPosition symbolPosition = (ListSymbolPosition)ListRenderer.GetListItemOrListProperty(this, parent , Property.LIST_SYMBOL_POSITION); if (symbolPosition == ListSymbolPosition.INSIDE) { if (childRenderers.Count > 0 && childRenderers[0] is ParagraphRenderer) { ParagraphRenderer paragraphRenderer = (ParagraphRenderer)childRenderers[0]; float? symbolIndent = this.GetPropertyAsFloat(Property.LIST_SYMBOL_INDENT); if (symbolIndent != null) { symbolRenderer.SetProperty(Property.MARGIN_RIGHT, UnitValue.CreatePointValue((float)symbolIndent)); } paragraphRenderer.childRenderers.Add(0, symbolRenderer); symbolAddedInside = true; } else { if (childRenderers.Count > 0 && childRenderers[0] is ImageRenderer) { Paragraph p = new Paragraph(); p.GetAccessibilityProperties().SetRole(null); IRenderer paragraphRenderer = p.SetMargin(0).CreateRendererSubTree(); float? symbolIndent = this.GetPropertyAsFloat(Property.LIST_SYMBOL_INDENT); if (symbolIndent != null) { symbolRenderer.SetProperty(Property.MARGIN_RIGHT, UnitValue.CreatePointValue((float)symbolIndent)); } paragraphRenderer.AddChild(symbolRenderer); paragraphRenderer.AddChild(childRenderers[0]); childRenderers[0] = paragraphRenderer; symbolAddedInside = true; } } if (!symbolAddedInside) { Paragraph p = new Paragraph(); p.GetAccessibilityProperties().SetRole(null); IRenderer paragraphRenderer = p.SetMargin(0).CreateRendererSubTree(); float? symbolIndent = this.GetPropertyAsFloat(Property.LIST_SYMBOL_INDENT); if (symbolIndent != null) { symbolRenderer.SetProperty(Property.MARGIN_RIGHT, UnitValue.CreatePointValue((float)symbolIndent)); } paragraphRenderer.AddChild(symbolRenderer); childRenderers.Add(0, paragraphRenderer); symbolAddedInside = true; } } } }
public void AddElement(FrameworkElement parent, FrameworkElement element, bool pushTask = false) { IRenderer parentRenderer = parent.GetRenderer(); IRenderer childRenderer = element.GetRenderer(); element.AddAdorner((Adorner)childRenderer); if (parent.DataContext != null && parent.DataContext is DependencyObject dataContext) { // Add On PObject Parent ObjectContentHelper.GetContent( dataContext, pi => pi.SetValue(dataContext, element.DataContext), // Single Content list => list.SafeAdd(element.DataContext)); // List Content } // Add On WPF Parent ObjectContentHelper.GetContent( parent, pi => pi.SetValue(parent, element), // Single Content list => list.SafeAdd(element)); // List Content this.AddElementCore(childRenderer); // Notice child added parentRenderer?.AddChild(childRenderer, childRenderer.Metadata.CreatedPosition); }
public virtual IRenderer CreateRendererSubTree() { IRenderer rendererRoot = GetRenderer(); foreach (IElement child in childElements) { rendererRoot.AddChild(child.CreateRendererSubTree()); } return(rendererRoot); }
private void ApplyListSymbolPosition() { if (symbolRenderer != null) { ListSymbolPosition symbolPosition = (ListSymbolPosition)ListRenderer.GetListItemOrListProperty(this, parent , Property.LIST_SYMBOL_POSITION); if (symbolPosition == ListSymbolPosition.INSIDE) { bool isRtl = BaseDirection.RIGHT_TO_LEFT.Equals(this.GetProperty <BaseDirection?>(Property.BASE_DIRECTION)); if (childRenderers.Count > 0 && childRenderers[0] is ParagraphRenderer) { ParagraphRenderer paragraphRenderer = (ParagraphRenderer)childRenderers[0]; float? symbolIndent = this.GetPropertyAsFloat(Property.LIST_SYMBOL_INDENT); if (symbolRenderer is LineRenderer) { if (symbolIndent != null) { symbolRenderer.GetChildRenderers()[1].SetProperty(isRtl ? Property.MARGIN_LEFT : Property.MARGIN_RIGHT, UnitValue .CreatePointValue((float)symbolIndent)); } foreach (IRenderer childRenderer in symbolRenderer.GetChildRenderers()) { paragraphRenderer.childRenderers.Add(0, childRenderer); } } else { if (symbolIndent != null) { symbolRenderer.SetProperty(isRtl ? Property.MARGIN_LEFT : Property.MARGIN_RIGHT, UnitValue.CreatePointValue ((float)symbolIndent)); } paragraphRenderer.childRenderers.Add(0, symbolRenderer); } symbolAddedInside = true; } else { if (childRenderers.Count > 0 && childRenderers[0] is ImageRenderer) { Paragraph p = new Paragraph(); p.GetAccessibilityProperties().SetRole(null); IRenderer paragraphRenderer = p.SetMargin(0).CreateRendererSubTree(); float? symbolIndent = this.GetPropertyAsFloat(Property.LIST_SYMBOL_INDENT); if (symbolIndent != null) { symbolRenderer.SetProperty(Property.MARGIN_RIGHT, UnitValue.CreatePointValue((float)symbolIndent)); } paragraphRenderer.AddChild(symbolRenderer); paragraphRenderer.AddChild(childRenderers[0]); childRenderers[0] = paragraphRenderer; symbolAddedInside = true; } } if (!symbolAddedInside) { Paragraph p = new Paragraph(); p.GetAccessibilityProperties().SetRole(null); IRenderer paragraphRenderer = p.SetMargin(0).CreateRendererSubTree(); float? symbolIndent = this.GetPropertyAsFloat(Property.LIST_SYMBOL_INDENT); if (symbolIndent != null) { symbolRenderer.SetProperty(Property.MARGIN_RIGHT, UnitValue.CreatePointValue((float)symbolIndent)); } paragraphRenderer.AddChild(symbolRenderer); childRenderers.Add(0, paragraphRenderer); symbolAddedInside = true; } } } }