internal static void LoadComponent(FrameworkElement control, Element node, bool isDesignMode = false, Action <int, FrameworkElement> ElementCreatedAtLine = null, string xml = null)
        {
            var builder = new UIBuilder
            {
                _rootNode     = node,
                DataContext   = control,
                Caller        = control,
                _isDesignMode = isDesignMode,
                XmlString     = xml
            };

            if (ElementCreatedAtLine != null)
            {
                builder.ElementCreatedAtLine += ElementCreatedAtLine;
            }

            var subControl = builder.BuildNode(builder._rootNode, control);

            var subControlAsFrameworkElement = subControl as FrameworkElement;

            if (subControlAsFrameworkElement == null)
            {
                throw new InvalidOperationException("ControlFirstItemMustBeHTMLElement");
            }

            InitDOM(control);
            control.AddLogicalChild(subControlAsFrameworkElement);
        }
        internal static void BuildControlTemplate(Template xmlTemplate, FrameworkElement control)
        {
            var builder = new UIBuilder
            {
                _rootNode           = xmlTemplate.Root,
                DataContext         = control,
                Caller              = control,
                _isBuildingTemplate = true
            };

            var subControl = builder.BuildNode(builder._rootNode, control);

            var subControlAsFrameworkElement = subControl as FrameworkElement;

            if (subControlAsFrameworkElement == null)
            {
                throw new InvalidOperationException("TemplateControlFirstItemMustBeHTMLElement");
            }

            control._root = subControlAsFrameworkElement._root;
            control.AddVisualChild(subControlAsFrameworkElement);
        }