public void AddControl(IControl control, Dictionary<string, object> properties) { ControlInstance instance = control.InstantiateUserControl(); foreach (string prop in properties.Keys) { instance.Properties[prop] = properties[prop]; } instance.OnClick += delegate(object o, EventArgs e) { _controller.ControlSelected(instance, o, e); }; instance.Update(); this.ControlInstances.Add(instance); this.Controls.Add(instance.UnderlyingControl); _controller.ControlSelected(instance, null, null); }