We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Open new XAML page using DataPointSelection

I would like to use DataPointSelection to open a new XAML page using NavigationPage. After adding a new class such as the following:

public class CustomSelectionBehavior : ChartSelectionBehavior
    {
        protected override async void OnSelectionChanged(ChartSelectionEventArgs arg)
        {
            base.OnSelectionChanged(arg);
            await Navigation.PushAsync(new SomePage());
        }
    }

I receive a "The name 'Navigation' does not exist in the current context" error.

What is the proper way to handle this?

Secondly, I need to open a different page based on what data point is selected, such as:

if (DataPointId == DataPoint1Id)
{
  // open data point 1 page
}
else if (DataPointId == DataPoint2Id
{
  // open data point 2 page
}
...

What is the proper way to handle this as well?

Thanks!

4 Replies

DW Drew Wilson June 22, 2016 07:36 PM UTC

I realized that I can add the PropertyChanged="ClickHandler" property to the Chart... The issue now is that this is fired the-number-of-data-points times immediately when the page loads. How to I prevent this from firing until a data point is actually selected? Using XAML


GM Gobi M Syncfusion Team June 23, 2016 09:33 AM UTC

Hi Drew Wilson, 
 
Thanks for using Syncfusion products. 
 
We are able to achieve your requirement using chart’s SelectionChanged event. We have prepared a sample for this and it can be downloaded in below link. 
 
 
Please let us know for any concerns. 
 
Regards, 
Gobi M 



DW Drew Wilson June 23, 2016 03:26 PM UTC

This worked perfectly. Thanks!


KV Karthikeyan V Syncfusion Team June 24, 2016 11:58 AM UTC

Hi Drew Wilson,  
 
Thanks for the update. 
 
Please let us know for any queries. 
 
Regards, 
Karthikeyan V.

Loader.
Live Chat Icon For mobile
Up arrow icon