My XamChart as 3 series which is binded with this.DataContext (CurrentPriceObj.PriceTrend which is a DataTable). When I got the onChange event fire I Invoke CurrentPrice .doCalculation which is simply adding a datarow. I pass back the datatable to a new LivePrice Class and invoke the new this.DataContext.
Everything works like a charge until this. Since the XamChart has a limited number or point that can be seen, I have to remove some datarow in my datatble during doCalculation. I Accept the changes of course and my XamChart does not appear anymore. And I do not have any error poping up.
What could possibly be wrong.
void _onChange(Addin_MktPrice_Interface.Change Changes) { try { CurrentPrice.RealPrice = (Addin_MktPrice_Interface.MarketPrice)Changes.Values; this.Dispatcher.BeginInvoke(new Action(() => CurrentPrice.doCalculation()), null);
LivePrice CurrentPriceObj = new LivePrice(); CurrentPriceObj.PriceTrend = CurrentPrice.PriceTrend; this.Dispatcher.BeginInvoke(new Action(() => this.DataContext = CurrentPriceObj), null);
GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace); } }
Hello,
I have been looking into your description however I am not able to figure out what might be the cause of your issue. I was wondering if you could please provide me with a sample I can continue my investigation.
Thanks in advance. Looking forward to hearing from you.
Attached is a very simple sample with the XamChart and one button.
Click on the button and it add one row into the datatable. When reaching 10 rows I remove the last row. This when xamchart disappear.
The xamchart is binded to the tabe.
Thanks