Build a CheckBoxList Property Type
public class CheckBoxList : INotifyPropertyChanged { private dynamic _values; private dynamic selectedItem; public event PropertyChangedEventHandler PropertyChanged; public event PropertyValueChangedEventHandler PropertyValueChanged; public CheckBoxList(String name, PropertyGrid pg) { PropertyName = name; PG = pg; } private String PropertyName { get; set; } private PropertyGrid PG { get; set; } public dynamic Values { get { return _values; } set { if (value != null) _values = value; } } public string ValueMember { get; set; } public string DisplayMember { get; set; } [Browsable(false)] public dynamic SelectedItem { get { return selectedItem; } set { String oldValue = selectedItem; selectedItem = value; if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(PropertyName)); if (PG != null) { if (PropertyValueChanged != null) PropertyValueChanged(this, new PropertyValueChangedEventArgs(PG.SelectedGridItem, oldValue)); } } } public override string ToString() { return SelectedItem; } }
You must be logged in to post a comment.