/// <summary>
        /// Clone the data of the 1st content control (that specified to save contents to copy) and append them to the end of the current selected content control
        /// </summary>
        public void CloneData()
        {
            // Get the "Content" content control, which is what we want to copy
            SdtElement target_copy_content_control = content_control.Descendants <SdtElement>().Where(s => s.Descendants <SdtAlias>().FirstOrDefault().Val.ToString().ToLower() == StaticValues.repeatcontent_cc_name).FirstOrDefault();

            content_control.AppendChild(target_copy_content_control.CloneNode(true));
        }
Ejemplo n.º 2
0
        public ContentControl Clone()
        {
            if (!(SdtElement.CloneNode(true) is SdtElement clonedElement))
            {
                return(null);
            }

            SdtElement.InsertBeforeSelf(clonedElement);
            var cloned = new ContentControl(clonedElement, IsDescendantOfAContentControl, TemplateDocument);

            TemplateDocument.AddControl(cloned, IsFirstOrder);
            cloned.GenerateDescendantsFromChildren();
            cloned.Parent = Parent;
            return(cloned);
        }