Posted 12 July 2021, 5:45 am EST - Updated 3 October 2022, 1:40 pm EST
See attached sample:
FlexThemeTest.zip
When a C1FlexGrid has SelectionMode = Row or RowRange or ListBox and a C1Theme is used, the full header row has always the “SelectedColumnHeader” theme color:
I don’t like this behavior, because the full header row is always highlighted and thus the color has no meaning at all to the user.
I would expect that e.g. the current col is highlighted or no column at all is highlighted:
I managed to achieve this by subclassing the grid and handling “OwnerDrawCell”: if a cell is to be drawn with style “SelectedColumnHeader”, then I reset it it the col is not selected:
protected override void OnOwnerDrawCell(OwnerDrawCellEventArgs e)
{
//If current cell has style "Selected column header"....
if (e.Style.Name == this.Styles.SelectedColumnHeader.Name)
{
//If current cell is not the grid col...
if (this.Col != e.Col)
{
//Reset style to "fixed"
e.Style = this.Styles.Fixed;
}
}
base.OnOwnerDrawCell(e);
}
But I don’t like this approach, because this would mean to make all our grids owner drawn. Is there anything better?
A long time ago, in the old forum, I had a similar question for VisualStyle, and in 2014 you added a check for “ShowThemedHeadersEnum.SelectedOnly”.
Is it possible to add this code for themes, too? Or do you have a better workaround then “OwnerDrawCell”?
Best regards
Wolfgang