Programatically Change SfDataGrid CheckBox Column

Hi, I am trying to implement a button where when it is clicked it will check all the checkboxes in my sfDataGrid's checkbox column. I used the following code below but the sfdatagrid does not update when I click the button.

            var model= (ViewModel)sfdatagrid.DataContext;
            //model.Orders.Clear();
            for(int i = 0; i < model.Orders.Count; i++)
            {
                model.Orders[i].Selected = true;
            }

Here, the .Selected property is a boolean which the checkbox column is bound to. Note that model.Orders.Clear() is able to delete all entries in the datagrid, but changing the property through model.Orders[i] do not work.

Thanks!

1 Reply 1 reply marked as answer

MA Mohanram Anbukkarasu Syncfusion Team May 17, 2021 01:05 PM UTC

Hi Sam, 
 
Thanks for contacting Syncfusion support.  
 
We suspect that you have not implemented INotifyPropertyChanged interface in your data model class. We have prepared a sample in which we have implemented INotifyPropertyChanged it works as expected. The sample we have prepared is available in the following link for your reference.  
 
 
Please let us know if  you require further assistance from us.  
 
Regards, 
Mohanram A. 


Marked as answer
Loader.
Up arrow icon