Adding an item to the <CustomClass> list, which is a DataBinded for a DataGrid
2 answers
Are you adding items to the List <CustomClass> data list in the background of the stream? You can then use the dispatcher to sort the Add call to return the UI thread:
Application.Current.Dispatcher.BeginInvoke(new Action(()=> { yourCollection.Add(yourItem); }))); Do this for all add and delete operations that modify the original collection.
You should also replace List <CustomClass> with ObservableCollection <gt; if you want the DataGrid to automatically update as you add items to the original collection. ObservableCollection provides notification of changes, but is not listed: http://msdn.microsoft.com/en-us/library/ms668604%28v=vs.110%29.aspx .
Also, make sure that you add items to the source collection, and not to the Items property of the DataGrid control.
+1