FlexGrid checkbox color based on CellStyle

Posted by: wknauf on 22 April 2024, 12:22 am EST

  • Posted 22 April 2024, 12:22 am EST - Updated 22 April 2024, 12:27 am EST

    Hi C1,

    there was a small behavior change in rendering of checkbox content in .636: see attached sample:

    FlexGridCheckBox.zip

    The grid has an “Alternate” style. The CellStyle backcolor is not applied to the checkbox background when the cell is focused. This happened in .631. Is the new rendering intended behavior or a regression? At least the white checkbox background does not look nice :wink:

    Please ignore the two rows with custom styles - I played with styles a bit, because I did not notice before now that the CellStyle colors are also applied to the checkbox. But I assume this was an intentional change and is contained in all .NET 6 versions.

    Best regards

    Wolfgang

  • Posted 22 April 2024, 9:54 pm EST

    Hello Wolfgang,

    Thank you for reporting this behavior. We have escalated it to the developers to get their insights on the behavior and will update you once we get the necessary information.

    As for the workaround, you can handle the AfterRowColChange event to set the backcolor of the cell as follows:

    if(e.NewRange.c1 == 2 && 
        e.NewRange.r1 != 3 && 
        e.NewRange.r1 != 4)   //handle custom cellstyles you have set
    {
        if (e.NewRange.r1 % 2 == 1)
        {
            e.NewRange.StyleNew.BackColor = c1FlexGrid1.Styles.Alternate.BackColor;
        }
        else
        {
            e.NewRange.StyleNew.BackColor = c1FlexGrid1.Styles.Normal.BackColor;
        }
    }


    Please refer to the attached sample for implementation. (see FlexGridCheckBox_Mod.zip)

    [Internal tracking ID: C1WIN-31990]

    Regards,

    Uttkarsh.

Need extra support?

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

Learn More

Forum Channels