private void RenderTemplate() { Stack.Children.Clear(); DisableModifiedTracking(); var hasEmptySection = false; foreach (var section in Sections) { section.Control = new UI.TemplateDesigner.TemplateSection(); section.Control.Initialize(this, section); Stack.Children.Add(section.Control); if (string.IsNullOrEmpty(section.Name)) { hasEmptySection = true; } var hasEmptyField = false; foreach (var field in section.Fields) { var fieldControl = new UI.TemplateDesigner.TemplateField(); field.Control = fieldControl; field.Section = section; fieldControl.Initialize(this, field); section.Control.FieldStack.Children.Add(fieldControl); if (string.IsNullOrEmpty(field.Name)) { hasEmptyField = true; } } if (!hasEmptyField) { section.Control.CreateEmpyField(); } } if (!hasEmptySection) { var newSection = new TemplateSection(); Sections.Add(newSection); newSection.Id = Guid.NewGuid().ToString(@"B").ToUpperInvariant(); newSection.Control = new UI.TemplateDesigner.TemplateSection(); newSection.Control.Initialize(this, newSection); Stack.Children.Add(newSection.Control); } EnableModifiedTracking(); }
public void HandleLostFocus([NotNull] UI.TemplateDesigner.TemplateField templateField) { ActiveField = null; Ribbon.Update(this); }