public TBuilder WithObjectProperty(object instance, PropertyDescriptor property) { var editor = DefaultPropertyInspectors.CreateEditor(property); if (editor != null) { editor.BoundPropertyDescriptor = new BoundPropertyDescriptor(instance, property); _inspectors.Add(editor); } return((TBuilder)this); }
private static void AddProperties(object instance, IEnumerable <PropertyDescriptor> properties, List <IInspector> inspectors) { foreach (var property in properties) { var editor = DefaultPropertyInspectors.CreateEditor(property); if (editor != null) { editor.BoundPropertyDescriptor = new BoundPropertyDescriptor(instance, property); inspectors.Add(editor); } } }
public TBuilder WithObjectProperties(object instance, Func <PropertyDescriptor, bool> propertyFilter) { var properties = TypeDescriptor.GetProperties(instance); foreach (PropertyDescriptor property in properties) { if (property.IsReadOnly || !property.IsBrowsable || !propertyFilter(property)) { continue; } var editor = DefaultPropertyInspectors.CreateEditor(property); if (editor != null) { editor.BoundPropertyDescriptor = new BoundPropertyDescriptor(instance, property); _inspectors.Add(editor); } } return((TBuilder)this); }