private void Populate(MyControlCollection thePage) { flowLayoutPanel1.Controls.Clear(); foreach (var control in thePage.Controls) { AddControl(control.ControlTypeName, control.IsXamlControl); } }
internal FormDynamic() { InitializeComponent(); toolStripMenuItemSave.Click += ToolStripMenuItemSave_Click; toolStripMenuItemOpen.Click += ToolStripMenuItemOpen_Click; thePage = new MyControlCollection(); thePage.Controls = new List <MyControl>(); isXamlIslandsSupported = GetIsSupported(); }
private void DeserializeObject(string fileName) { XmlSerializer serializer = new XmlSerializer(typeof(MyControlCollection)); using (Stream reader = new FileStream(fileName, FileMode.Open)) { // Call the Deserialize method to restore the object's state. thePage = (MyControlCollection)serializer.Deserialize(reader); Populate(thePage); } }