[Page A ----PushAsync---> Page B] The sfchart is not updated when viewmodel is updated by MessageCenter?

Hi support team,
   
     The sfdatagrid is updated async but not the sfchart.
     The attachfile contains two situation :
          Failed : Red line
          Success : Green line

Class Page_A : ContentPage{
     void btn_Calculate_Clicked(object sender, EventArgs e)
        {
            MessagingCenter.Send(this, "IpCal" , viewModel);  //The ViewModel class will handle it in async.

            Navigation.PushAsync(new Page_B(viewModel)); //Navigate to Page B with current viewModel. (See the Failed.jpg)
            //navDrawer_Calculate.ToggleDrawer(); //Toggle panel and show the data on the same page(See the Success.jpg)
        }
}

Class Page_B : ContentPage{
     ViewModel viewModel;
     public Page_B(ViewModel vm){
          BindingContext = viewModel = vm;
     }
}

Attachment: SfChart_Not_Updated_a1a10480.rar

8 Replies

YS Yin Shun March 15, 2020 09:19 AM UTC

Hi,
   
   Is it a good solution?
   I tried to listen the ViewModel on Page_B as below:

    Class Page_B : ContentPage{
         ViewModel viewModel;
         public Page_B(ViewModel vm){
             
            BindingContext = viewModel = vm;
             
            viewModel.PropertyChanged += ViewModel_PropertyChanged;
     }

       
        private void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            sfChartPremiumDetails.BindingContext = viewModel;
        }

Best regards,
Jason


DD Devakumar Dhanapoosanam Syncfusion Team March 16, 2020 12:59 PM UTC

Hi Yin Shun, 
 
Greetings from Syncfusion. 
 
We have validated the reported issue and we were unable to reproduce the reported issue at our end. 
 
Can you please share the following details which will be helpful for us to analyze the reported issue at our end and provide a better solution at earlier? 
·       Please share the chart related code snippet and the ViewModel class. 
·       Please share the complete Page_B code snippet. 
 
Regards, 
Devakumar D 



YS Yin Shun March 16, 2020 02:52 PM UTC

Hi,

  Thanks for reply. fyi!

Attachment: sfChart_6b8edf7.rar


SJ Suyamburaja Jayakumar Syncfusion Team March 17, 2020 04:12 PM UTC

Hi Yin Shun, 
 
Thanks for your update.  
 
Currently we are validating the reported issue with the provided code snippet and we will update the complete details on or before March 19, 2020.  
 
Regards, 
Suyamburaja J. 



YS Yin Shun March 18, 2020 05:40 AM UTC

Hi Suyamburaja J.,

  Thanks please take your time =)!

Best regards,
Jason


SJ Suyamburaja Jayakumar Syncfusion Team March 19, 2020 02:12 PM UTC

Hi Yin Shun, 
 
Thanks for your patience.    
 
We have checked the provided code snippet due to some insufficient data, we have modified that sample with our temporary data to plot the chart in that it will be worked fine. Please find the tested sample in below, 
 
 
can you please modify the provided sample to reproduce the reported issue. which will be helpful for us to analyze further and provide a possible solution at earlier. 
 
Regards, 
Suyamburaja J. 



YS Yin Shun March 19, 2020 03:34 PM UTC

Hi ,

   Thanks for your demo. According to your, it works after uncomment =)!
<!--
<chart:SfChart.BindingContext>
<viewmodels:SelectedCalIpList_ViewModel />
</chart:SfChart.BindingContext>
-->

Best regards,
Jason


SJ Suyamburaja Jayakumar Syncfusion Team March 20, 2020 06:34 AM UTC

Hi Yin Shun,  
  
We are glad to hear that your requirement has been achieved.  
  
Please let us know if you need any further assistance on this.  
  
Regards, 
Suyamburaja J. 


Loader.
Up arrow icon