Pergunta

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,

Foi útil?

Solução

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;
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top