This question is locked. New answers and comments are not allowed.
I have two pieces of code which do the exact same thing when populating a RadGridView, but when I try to call this on one of them:
... it receives an error:
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Looking at the grid it obvious it has no columns yet (Count = 0). I have tried Rebind() with no success. I'm not sure why this is not working the same way the similar code is which employs the exact same technique. The data is available and appearing without issue and AutoGenerateColumns is set to true yet the columns are not present.
Is there some event I should wait to complete once I bind before I set the SortingState? Any thoughts on what could be causing this?
Thank you in advance.
grid.ItemsSource = data;
grid.Columns[0].SortingState = SortingState.Descending;
... it receives an error:
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Looking at the grid it obvious it has no columns yet (Count = 0). I have tried Rebind() with no success. I'm not sure why this is not working the same way the similar code is which employs the exact same technique. The data is available and appearing without issue and AutoGenerateColumns is set to true yet the columns are not present.
Is there some event I should wait to complete once I bind before I set the SortingState? Any thoughts on what could be causing this?
Thank you in advance.