DataGrid: When setting the Binding Context to null , the column binding context is not cleared
The column binding context is not cleared when setting the Binding Context to null on the DataGrid control.
1 comment
ADMIN
Nasko
Posted on:16 Jun 2023 10:32
Hello,
The status of this bug report is changed to Won't Fix.
Passing the BindingContext from the parent RadDataGrid to the DataGridColumns happens through the SetInheritedBindingContext method of the BindableObject. Setting the context through the method does not set the BindingContext property - the value of the property is its default one which is null. Because of that setting the property to null does not have any effect.
To set the BindingContext of the DataGridColumn immediately to null the SetInheritedBindingContext method should be used:
Setting the BindingContext explicitly to null is not even necessary, because RadDataGrid handles that for you. It will set the context of the DataGridColumns to null when its context is set to null. Also, the SetInheritedBindingContext sets the BindingContext to a WeakReference which allows the garbage collector to collect and release the memory taken by the context even if its value is not explicitly set to null.