How to create checkbox in FlexGrid?

Posted by: ronen.hong on 6 June 2023, 8:25 pm EST

    • Post Options:
    • Link

    Posted 6 June 2023, 8:25 pm EST

    can you guide me how to create checkbox in FlexGrid cell?

    and how to get row datas which is checked in cs file?

  • Posted 7 June 2023, 10:34 pm EST

    Hi kyungsoo,

    When a FlexGrid’s column is bound to a boolean property, a checkbox is automatically created, and its IsChecked property is set based on the value of the bound boolean data. To fetch the data items of the checked rows, you can use the following code:

    var str = "";
                foreach(var row in flexgrid.Rows)
                {
                    var dataItem = row.DataItem as UserDataItem;
                    if(dataItem.Check == true)
                    {
                        str += (dataItem.Sno + ":" + dataItem.Group + "\n");
                    }                
                }

    Kindly refer CheckBoxCellBool.zip for implementation.

    Alternatively, you can set the checkbox in a column by assigning the CellTemplate to the column in XAML code. The same code mentioned above can be used to retrieve the checked data rows. Please refer to CheckBoxCellXAML.zip for implementation.

    It’s worth noting that using the GridCellFactory to create checkboxes in a Grid column is not recommended as it introduces unnecessary overhead, unless it is specifically required.

    Hope you find this helpful. Kindly let us know if you need any further help regarding this.

    Thanks & Regards,

    Aastha

Need extra support?

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

Learn More

Forum Channels