Вопрос

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