public CustomPropertyDescriptor(JxCustomProperty myProperty, Attribute[] attrs) : base(myProperty.Name, attrs) { if (myProperty == null) { oCustomProperty = null; } else { oCustomProperty = myProperty; } }
public virtual int Add(JxCustomProperty value) { return(base.List.Add(value)); }
[RefreshProperties(RefreshProperties.All)] public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value) { if (context == null || provider == null || context.Instance == null) { return(base.EditValue(provider, value)); } oEditorService = (System.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (oEditorService != null) { // Get the Back reference to the Custom Property JxCustomProperty.CustomPropertyDescriptor oDescriptor = (JxCustomProperty.CustomPropertyDescriptor)context.PropertyDescriptor; JxCustomProperty cp = (JxCustomProperty)oDescriptor.CustomProperty; // Declare attributes UIListboxDatasource datasource; UIListboxValueMember valuemember; UIListboxDisplayMember displaymember; // Get attributes datasource = (UIListboxDatasource)context.PropertyDescriptor.Attributes[typeof(UIListboxDatasource)]; valuemember = (UIListboxValueMember)context.PropertyDescriptor.Attributes[typeof(UIListboxValueMember)]; displaymember = (UIListboxDisplayMember)context.PropertyDescriptor.Attributes[typeof(UIListboxDisplayMember)]; oList.BorderStyle = BorderStyle.None; oList.IntegralHeight = true; if (datasource != null) { oList.DataSource = datasource.Value; } if (displaymember != null) { oList.DisplayMember = displaymember.Value; } if (valuemember != null) { oList.ValueMember = valuemember.Value; } if (value != null) { if (value.GetType().Name == "String") { oList.Text = (string)value; } else { oList.SelectedItem = value; } } oList.SelectedIndexChanged += new System.EventHandler(this.SelectedItem); oEditorService.DropDownControl(oList); if (oList.SelectedIndices.Count == 1) { cp.SelectedItem = oList.SelectedItem; cp.SelectedValue = oSelectedValue; value = oList.Text; } oEditorService.CloseDropDown(); } else { return(base.EditValue(provider, value)); } return(value); }