public void BindData(ITypeDescriptorContext context, object value, object[] attributeArguments) { PropertyDescriptor propertyDescriptor = context.PropertyDescriptor; itemsEditorAttribute = propertyDescriptor.Attributes.OfType <ItemsEditorAttribute>().Single(); IEnumerable <ITreeNodeData> collection = (IEnumerable <ITreeNodeData>)value; itemsEditorValidator = itemsEditorAttribute.CreateValidator(context.Instance); Initialize(itemsEditorAttribute.EditorOptions, collection); if (!string.IsNullOrEmpty(itemsEditorAttribute.EditorCaption)) { this.Text = itemsEditorAttribute.EditorCaption; } if (!string.IsNullOrEmpty(itemsEditorAttribute.EditorTitle)) { lbTitle.Text = itemsEditorAttribute.EditorTitle; } else { lbTitle.Visible = false; } }
public IItemsEditorValidator CreateValidator(object container) { IItemsEditorValidator validator = null; if (ValidationType != null) { validator = (IItemsEditorValidator)Activator.CreateInstance(ValidationType); validator.Owner = this; validator.SetContainer(container); } return(validator); }