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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Open new XAML page using DataPointSelection

Thread ID:

Created:

Updated:

Platform:

Replies:

124684 Jun 22,2016 05:26 PM UTC Jun 24,2016 11:58 AM UTC Xamarin.Forms 4
loading
Tags: SfChart
Drew Wilson
Asked On June 22, 2016 05:26 PM UTC

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!

Drew Wilson
Replied On 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

Gobi M [Syncfusion]
Replied On 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 


Drew Wilson
Replied On June 23, 2016 03:26 PM UTC

This worked perfectly. Thanks!

Karthikeyan V [Syncfusion]
Replied On June 24, 2016 11:58 AM UTC

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;