I have bound the GridDataControl to an ObjectDataProvider like so:
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
xmlns:MarketFilter="clr-namespace:Chimera.MarketFilter" Loaded="WindowLoaded" >
x:Name="grid"
AutoPopulateColumns="True"
AutoPopulateRelations="False"
ShowAddNewRow="False"
ItemsSource="{Binding Source={StaticResource stocks}}"
ColumnSizer="Auto"
VisualStyle="Office14Silver"
Loaded="GridLoaded"
NotifyPropertyChanges="True" >
the MarketData class is attached. It inherits from ObservableCollection and contains a collection of the Stock class which implements INotifyPropertyChanged. This collection is updated by an event from DataFeed very quickly.
When I click on a column header and it sorts by that column it immediately throws:
A first chance exception of type 'System.InvalidOperationException' occurred in System.dll
Then in a bit:
A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
The rows start to disappear and then the grid is empty.
If I turn off the updating then the problem goes away and I can sort fine off of the starting data.
The error doesn't seem to be coming from my update code, I put a break point in the catch and it never hit.
Seems like a threading issue where access to the ObservableCollection isn't locked.
Any ideas what is causing this?
sorter_2e1667a3.rar