Search code examples
winformsdevexpresspropertygrid

How to assign custom class to PropertyGridControl.SelectedObject at design time


How could I assign a custom class (Customer, Order, etc) to a DevExpress PropertyGridControl (or native Windows.Forms.PropertyGrid) at Design Time?
The PropertyGridControl.SelectedObject's dropdown list shows only the other Controls used in the form, but not custom fields declared by me. For instance:

Dim oCustomer As new Customer

I'd like to customize MultiEditorRows, styles, etc at design time to show my object properly.
At runtime it's as easy as:

myPropertyGridControl.SelectedObject = New Customer

Any help would be greatly appreciated. Please excuse my bad english.


Solution

  • At design-time only components that exist on a form can be selected as the grid's SelectedObject. Of cause, you can make your object a Component descendant and drop it onto a form to select it. But, I don't think that you really need this. As far as I understand, you need to generate grid rows at design time to customize them. If so, it's better to use the Rows Page designer to manually add the required rows and customize them.