Reputation: 715
I am binding the xamdatagrid to a list.But since there are too many updates on the list GUI get stuck.How can I stop these updates and refresh the grid after an interval(say 500 ms).Will Reactive extension's throttle method be useful?
Upvotes: 1
Views: 1119
Reputation: 292695
You can use the DeferRefresh
to defer the binding update until you're done making modifications to the collection:
using (collection.DeferRefresh())
{
// Make changes to the collection
...
}
If the collection is being updated in real time, you could use a timer to update the binding at intervals:
private IDisposable _deferral;
private void refreshTimer_Tick(object sender, EventArgs e)
{
if (_deferral != null)
_deferral.Dispose();
_deferral = collection.DeferRefresh();
}
Upvotes: 4