public override PropertyDescriptorCollection GetItemProperties() { PropertyDescriptor property = parent.GetItemProperties().Find(property_name, true); // We can't just pass property.PropertyType, since the actual object could implement // more elements and not only those described in the property type return(TypeDescriptor.GetProperties(property.GetValue(parent.Current))); }
private BindingManagerBase CreateBindingManager(object data_source, string data_member) { if (data_member == "") { if (IsListType(data_source.GetType())) { return(new CurrencyManager(data_source)); } else { return(new PropertyManager(data_source)); } } else { BindingMemberInfo info = new BindingMemberInfo(data_member); BindingManagerBase parent_manager = this[data_source, info.BindingPath]; PropertyDescriptor pd = parent_manager == null ? null : parent_manager.GetItemProperties().Find(info.BindingField, true); if (pd == null) { throw new ArgumentException(String.Format("Cannot create a child list for field {0}.", info.BindingField)); } if (IsListType(pd.PropertyType)) { return(new RelatedCurrencyManager(parent_manager, pd)); } else { return(new RelatedPropertyManager(parent_manager, info.BindingField)); } } }