[C1Flexgrid] Styling the Focus Rectangle

Posted by: gonzales.harriet8 on 19 August 2018, 12:29 pm EST

    • Post Options:
    • Link

    Posted 19 August 2018, 12:29 pm EST

    Is there a way to style the focus rectangle of the C1Flexgrid such that when a cell is clicked, the coverage of the focus rectangle will be the whole row? Currently, the focus rectangle will only cover the clicked cell or the span of spilled texts.

    In addition, I don’t want to use the Highlight option because it has a background color. I just want to achieve a border around the selected row to subtly indicate which area of the grid has been clicked.

  • Posted 19 August 2018, 4:50 pm EST

    Hi,

    You can create a style with border and apply to it to active row in AfterRowColChange event:

    private void _flex_AfterRowColChange(object sender, RangeEventArgs e)
    {
        for (int row = e.OldRange.TopRow; row <= e.OldRange.BottomRow; ++row)
            _flex.Rows[row].Style = _flex.Styles.Normal;
         _flex.Rows[e.NewRange.TopRow].Style = _focusRowStyle;
    }
    

    Alternatively, you can also show the record selector icon on the first fixed column by using ShowCursor property of C1FlexGrid:

    _flex.ShowCursor = true;
    

    You can also find a sample to demonstrate this in the attachments.

    Regards.

    FocusRectangleStyle.zip

Need extra support?

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

Learn More

Forum Channels