Binding data to Combobox in custom activity designer

后端 未结 3 1288
粉色の甜心
粉色の甜心 2021-01-04 12:59

I have a custom activity, with a single in argument which is a string. However, rather than allow the designer to enter an arbitrary string, I want the designer to be presen

3条回答
  •  春和景丽
    2021-01-04 13:09

    One way to solve it is to define your own ComboBoxEditor which derives from UITypeEditor. Expose the collection you want to bind this combobox in the activity class and decorate your bindable property in Activity class with following attribute :

    [EditorAttribute(typeof(CustomListBoxEditor), typeof(System.Drawing.Design.UITypeEditor))]
    

    Also in the custom comboboxEditor you will have to modify your EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) method to get the collection and bind it to the combobox.

提交回复
热议问题