Hi,
So i have an event that fires from my VM and this is handled in my .xaml.cs code behind file in my view.
Handler is below. I put the 2 if statements to test if they were the reasons for the error but they are not.
The code still runs and throws exception on dataGrid.GridColumnSizer.Refresh();
I have confirmed dataGrid.GridColumnSizer is not null (prior line would have otherwise thrown excpetion).
What is internally throwing the null exception? How can i check?
private void Vm_UiRefreshRequest()
{
if (!dataGrid.IsLoaded)
{ return; }
if (dataGrid.ItemsSource is ICollection coll && coll.Count > 0)
{
//has rows
dataGrid.GridColumnSizer.ResetAutoCalculationforAllColumns();
dataGrid.GridColumnSizer.Refresh();
}
}