C1FlexGrid and themes: full header has "SelectedColumnHeader" theme

Posted by: wknauf on 12 July 2021, 5:45 am EST

    • Post Options:
    • Link

    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

  • Posted 12 July 2021, 5:46 am EST

    I forgot to add: my sample opens two forms. One is the new ribbon with themes, the other has the old ribbon with VisualStyle. Here, you see that the header row works as I expect.

  • Posted 12 July 2021, 6:31 pm EST

    Hello,

    We too can observe the behavior at our end and forwarded it to the developers for investigation.

    We will let you know as soon as we get an update on this.

    [Internal Tracking ID: C1WIN-25263]

    Regards,

    Prabhat Sharma.

  • Posted 14 July 2021, 8:12 pm EST

    While digging through an old support issue (https://supportone.componentone.com/casedetail/103796), I noticed that in the sample attached to the issue the themed headers worked as expected.

    This pointed me to the core of the issue: a call to “C1ThemeController.ApplyThemeToControlTree” resets the property “ShowThemedHeaders” to “None”.

    If I reset it to “SelectedOnly” afterwards, my code works.

    See attached sample.

    FlexThemeTest_2021-07-15.zip

    So the remaining issue is that “ApplyThemeToControlTree” resets “ShowThemedHeaders”. It this intended or a bug?

    Best regards

    Wolfgang

  • Posted 15 July 2021, 9:03 pm EST

    Hello Wolfgang,

    Thank you for your additional comments, we have forwarded this to the developers.

    And per the developers’ latest comment the issue will be fixed in the 2021v3 release.

    Regards,

    Prabhat Sharma.

  • Posted 9 February 2022, 9:07 pm EST

    This issue was fixed in .532:

    [FlexGrid] ShowThemedHeaders property had no effect when theme is applied. (Jira:C1WIN-25263)

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels