Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
195
Chart disappear on Databing
posted

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);
            }
           
        }

Parents Reply Children