devexpressdevexpress-windows-uidevexpress-gridcontrol

Displaying List<string> in a grid column


Is there a way that one can use a control in a gridview that displays a simple List<string> in a dropdown just like SearchLookUp or even a simple Dropdown? The tricky part is that this List<string> is not predefined, it can change for each row in the grid.

For example if I have a grid with each row representing an ECU of a vehicle. This object contains a List<string> representing SoftwareVersion allowed for the ECU, among st which the user can then select one that is in accordance to their needs. Since each ECU can have different software versions, I cannot assign a pre-defined data source and bind it to SearchLookUpEdit . So I am searching for a solution to make it happen.

Any suggestions will be highly appreciated.


Solution

  • You can use a RepositoryItemComboBox control for this. In order to have a different list of ECU items in each row, handle the GridView's CustomRowCellEdit event and assign the editor at runtime.

    You can add all of the strings in your List to the editor's Items collection and additionally set the TextEditStyle property to TextEditStyles.DisableTextEditor to prevent the end-user from typing in their own values.