How to create a checkbox in the WPF Flexgrid Header in .Net 6.0

Posted by: rambabu on 30 May 2023, 12:30 am EST

    • Post Options:
    • Link

    Posted 30 May 2023, 12:30 am EST

    Hello,

    can you please let me know how to implement the WPF flex grid header checkbox?

  • Posted 30 May 2023, 7:50 pm EST

    Hi Rambabu,

    You can create checkbox in WPF flexgrid header by overriding PrepareCell method of GridCellFactory class. You can refer to the following code for the same:

    public override void PrepareCell(GridCellType cellType, GridCellRange range, GridCellView cell, Thickness internalBorders)
    {
        base.PrepareCell(cellType, range, cell, internalBorders);
        if (cellType == GridCellType.ColumnHeader && range.Column == 2)
        {
            var checkBox = new CheckBox();
            checkBox.Content = "Check";
            cell.Content = checkBox;
            cell.Content.VerticalAlignment = VerticalAlignment.Center;
        }
    }

    Please refer to the attached sample for full implementation. See

    CheckboxHeaderNET6.zip

    Thanks & Regards,

    Aastha

  • Posted 2 June 2023, 7:09 am EST

    Thank you, Aastha,

Need extra support?

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

Learn More

Forum Channels