Beispiel #1
0
        public static IHxlElementTemplate GetElementTemplate(this DomElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            var result = element.Annotation <ElementTemplateAnnotation>();

            return(result == null ? null : result.Template);
        }
Beispiel #2
0
        public static void SetElementTemplate(this DomElement element, IHxlElementTemplate template)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            if (template == null)
            {
                element.RemoveAnnotations <ElementTemplateAnnotation>();
                return;
            }

            var result = element.Annotation <ElementTemplateAnnotation>();

            if (result == null)
            {
                result = new ElementTemplateAnnotation();
                element.AddAnnotation(result);
            }
            result.Template = template;
        }