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

DoughnutSeries SelectedDataPointIndex TwoWay Binding

Thread ID:





126181 Sep 28,2016 11:40 PM UTC Sep 30,2016 12:25 PM UTC Xamarin.Forms 3
Tags: SfChart
Juan (Charly) Garibay
Asked On September 28, 2016 11:40 PM UTC

Hi guys,

I'm using Syncfusion Xamarin SfChart to display a Doughnut Chart in one of my projects. I have a items list and a chart. When I select an item from list I set SelectedDataPointIndex of chart through a property in viewmodel, all works fine. But when I touch a chart fragment nothing happens in my viewmodel, it doesn't detect the new index.

I'm using Syncfusion.SfChart.XForms version 14.2451.0.32.

Here is my code:

<chart:SfChart BackgroundColor="White" HeightRequest="200">
        <chart:ChartTitle Text="Doughnut Chart" TextColor="White"/>
        <chart:DoughnutSeries ItemsSource="{Binding Accounts}"
            SelectedDataPointIndex="{Binding Chart_SelectionIndex}">
                <chart:ChartColorModel Palette="Custom" CustomBrushes="{Binding Colors}"/>

<ListView ItemsSource="{Binding Accounts}" HeightRequest="200" SelectedItem="{Binding List_SelectedItem}">
                <StackLayout Padding="5,5">
                    <Label Text="{Binding Description}" />

public class DoughnutViewModel : INotifyPropertyChanged
        #region Chart
        private int Chart_selectionIndex;
        public int Chart_SelectionIndex
                return Chart_selectionIndex;
                Chart_selectionIndex = value;

        #region List
        private Account List_selectedItem;
        public Account List_SelectedItem
                return List_selectedItem;
                List_selectedItem = value;

                var index = Accounts.IndexOf(value);
                Chart_SelectionIndex = index;


        #region Property Changed
        public event PropertyChangedEventHandler PropertyChanged;
        public void OnPropertyChanged([CallerMemberName] string property = null) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));

        public ObservableCollection<Account> Accounts { get; set; }

        public List<Color> Colors { get; set; }

        public DoughnutViewModel()
            Accounts = new ObservableCollection<Account>();
            Accounts.Add(new Account { Description = "Checking 1", Amount = 1000 });
            Accounts.Add(new Account { Description = "Checking 2", Amount = 2000 });
            Accounts.Add(new Account { Description = "Checking 3", Amount = 3000 });
            Accounts.Add(new Account { Description = "Checking 5", Amount = 5000 });
            Accounts.Add(new Account { Description = "Checking 8", Amount = 8000 });
            Accounts.Add(new Account { Description = "Checking 13", Amount = 13000 });

            Colors = new List<Color>();

What could it be?

Thanks in advance,

Jaikrishna Chandrasekar [Syncfusion]
Replied On September 29, 2016 06:18 PM UTC

Hi Juan, 

Thanks for contacting Syncfusion support. 

We have analyzed your code snippet and founded that code for selecting the list item when touching the chart fragment was missing . We have modified the code and prepared a sample based on your requirement, it can be downloaded from the below location. 

Please let us know if you have any queries. 

Jaikrishna C 

Juan (Charly) Garibay
Replied On September 29, 2016 08:10 PM UTC

Hi Jaikrishna,

I downloaded the sample and when I select/touch a chart fragment, It doesn't update list selection.


It seems chart never updates a binding property but it updates selection based in binding property.

Jaikrishna Chandrasekar [Syncfusion]
Replied On September 30, 2016 12:25 PM UTC

Hi Juan, 

Sorry for the inconvenience caused.  

We have modified a sample based on your requirement and it can be downloaded from the below location. 

Jaikrishna C  


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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