سؤال

I have a custom object that can be edited from a PropertyGrid (DevExpress) via a custom TypeEditor (talking about .NET, c# and winforms).

The "entry point" in my custom UITypeEditor is the method

public override object EditValue(ITypeDescriptorContext context,
                                 IServiceProvider provider,
                                 object value)

that is called when someone tries to edit the value from the propertyGrid.

Everything works fine, but how can I handle a multiselection? When someone selects two objects in the property grid, value param is null, Is there any way to get a list with the values? Or any way to handle this type of behaviour?

thanks,

هل كانت مفيدة؟

المحلول

In this case, context.Instance contains an array of objects with the selected values:

public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
    object[] selectedValues = (object[])context.Instance;
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top