I have a DevExpress GridView whose cells are painted with a random color based on some condition. Now each color has a meaning and I want to show it as a legend. Number of colors used for each condition may vary.
How can I do this. Please help.
I’m using DevExpress 2009 Vol2, and .Net framework – 2.0 and WinForms
You might try using another GridControl. DataSource would be this simple class:
You would populate it while building your color list; I don’t know your setup so, for example,
GridControl would have two columns, first one for Color and second for Caption. You must set ColumnEdit property of first column to ColorEdit. In order to avoid color name being displayed set AppearanceCell’s ForeColor property to transparent. Also set FixedWidth in OptionsColumn to true and Width to some nice number (32 for my system).
View should be uneditable (OptionsBehavior.Editable = false) and focus should not use it’s own appearance (OptionsSelection.EnableAppearanceFocusedRow = false). Additionally, you might hide header, hide row indicators, disallow GridControl from receiving focus etc.
I hope this helps, even if it arrives two weeks late.