Esempio n. 1
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;
        }