private Control GetBindingControl(ControllerBinding binding, ITypeDescriptorContext context) { Control control = binding.ControlInstance; if (control == null && binding.ControlID != null) { IDesignerHost host = (IDesignerHost)context.GetService(typeof(IDesignerHost)); if (host != null) { foreach (IComponent component in host.Container.Components) { control = component as Control; if (control != null) break; } } } return control; }
private string SelectDefaultEvent(Control control, ControllerBinding binding) { EventDescriptor defaultEvent = EventUtil.GetDefaultEvent( control, delegate(EventDescriptor eventDescriptor) { string eventName = eventDescriptor.Name; return binding.ActionBindings[eventName] == null; }); return (defaultEvent != null) ? defaultEvent.Name : null; }
private Control FindControlInContainer(ITypeDescriptorContext context, ControllerBinding parent) { IControllerBinder binder = (IControllerBinder)context.GetService(typeof(IControllerBinder)); if (binder != null) { return binder.FindControlWithID(parent.ControlID); } return null; }
private Control ObtainTargetControl(ITypeDescriptorContext context, out ControllerBinding parent) { parent = null; Control control = null; ActionBinding binding = context.Instance as ActionBinding; if (binding != null && binding.Parent != null) { parent = binding.Parent; control = parent.ControlInstance; if (control == null) { control = FindControlInContainer(context, parent); } } return control; }