public static EFTemplate BuildTemplateFromDataContainer(IEnumerable<DataControl.DataContainer> dataContainer) { var root = new EFTemplate(); root.ElementName = "Root Template"; root.OrderIndex = 1; int idx = 2; foreach (var container in dataContainer) { idx++; var dataUnit = container.Data; var field = dataUnit.DataField; var tmpl = new EFTemplate(); tmpl.DataField = field; tmpl.ElementName = field.FieldName; tmpl.Parent = root; tmpl.OrderIndex = idx; } return root; }
private static void UpdateLayoutPanelFromTemplate(EFTemplate template, DataContainerLayoutPanel panel, bool editMode) { foreach (var tmpl in template.Children) { UpdateLayoutPanel(tmpl.DataField, panel, editMode); UpdateLayoutPanelFromTemplate(tmpl, panel, editMode); } }
public static void BuildDataContainerFromTemplate(EFTemplate template, DataContainerLayoutPanel panel, bool editMode) { panel.Controls.Clear(); UpdateLayoutPanelFromTemplate(template, panel, editMode); }