private void CreateBindings() { bindings = new PropertyBindingCollection(); ManagedPropertiesService svc = (ManagedPropertiesService)component.Site.GetService(typeof(ManagedPropertiesService)); if (svc != null) { PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(component, new Attribute[] { BrowsableAttribute.Yes }); for (int i = 0; i < properties.Count; i++) { PropertyDescriptor prop = properties[i]; if (prop.DesignTimeOnly) { continue; } if (prop.IsReadOnly) { continue; } if (prop.Attributes.Contains(DesignerSerializationVisibilityAttribute.Hidden)) { continue; } // don't show the ComponentSettings property - it can't be managed! if (prop.PropertyType == typeof(ComponentSettings)) { continue; } if (!ManagedPropertiesService.IsTypeSupported(prop.PropertyType)) { continue; } PropertyBinding binding = svc.Bindings[component, prop]; if (binding == null) { binding = new PropertyBinding(host); binding.Component = component; binding.Property = prop; binding.Reset(); } else { binding = (PropertyBinding)binding.Clone(); } bindings.Add(binding); } } }
/// <include file='doc\BindingPropertyDescriptor.uex' path='docs/doc[@for="BindingPropertyDescriptor.GetValue"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public override object GetValue(object component) { PropertyBinding binding = compSettings.Bindings[compSettings.Component, property]; if (binding == null) { // this will only happen if the property was "recommended" but it had never // been bound. binding = new PropertyBinding(GetHost()); binding.Component = compSettings.Component; binding.Property = property; binding.Reset(); compSettings.Bindings[compSettings.Component, property] = binding; } return(binding); }
/// <include file='doc\BindingPropertyDescriptor.uex' path='docs/doc[@for="BindingPropertyDescriptor.ResetValue"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public override void ResetValue(object component) { PropertyBinding binding = (PropertyBinding)GetValue(component); binding.Reset(); }