public List <HTMLComposablePartDefinition> AddFragmentWithKey(string key, string fragment, bool addToParts = true)
        {
            var container = doc.CreateElement("div");

            container.InnerHtml = fragment;
            var root    = container.Children[0];
            var exports = root.Children.OfType <System.Windows.Forms.HtmlElement>().Where(e => !String.IsNullOrEmpty(e.GetAttribute(exportAttributeName)));
            List <HTMLComposablePartDefinition> parts = new List <HTMLComposablePartDefinition>();

            if (exports.Any())
            {
                foreach (var export in exports)
                {
                    var part = new HTMLComposablePartDefinition(export);

                    parts.Add(part);
                    if (addToParts)
                    {
                        htmlParts.Add(part);
                    }
                }
                if (addToParts)
                {
                    keyedParts.Add(key, parts);
                }
            }
            return(parts);
        }
        internal static HTMLComposablePart CreateRootPart(HtmlElement rootElement)
        {
            var partDefinition = new HTMLComposablePartDefinition(rootElement);

            partDefinition.toString = rootIdentifier;
            return(partDefinition.CreateRootPart());
        }
Beispiel #3
0
 public static HTMLComposablePart CreateRootPart(HtmlElement rootElement)
 {
     return(HTMLComposablePartDefinition.CreateRootPart(rootElement));
 }
Beispiel #4
0
 internal HTMLComposablePart(HTMLComposablePartDefinition definition, HtmlElement exportedElement)
 {
     this.exportedElement = exportedElement;
     this.partDefinition  = definition;
 }