//Hongjia's codes end /// <summary> /// Loops through children of an <see cref="INode"/> and appends as <see cref="UIElement"/> to given <see cref="UIElementCollection"/>. /// </summary> /// <param name="node">The parent <see cref="INode"/>.</param> /// <param name="elements">The <see cref="UIElementCollection"/> collection to add elements to.</param> protected void AddChildren(INode node, BlockCollection elements) { var nodeQueue = UnfoldTagToCollection(node); foreach (var child in nodeQueue) { var element = GenerateBlockForNode(child, elements); if (elements.LastOrDefault() != element) { elements.Add(element); } } }
private Paragraph GetOrCreateLastParagraph(BlockCollection blocks) { var lastBlock = blocks.LastOrDefault(); if (lastBlock != null) { return((Paragraph)lastBlock); } var paragraph = new Paragraph(); blocks.Add(paragraph); return(paragraph); }