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
300
Bind XamPieChart ItemsSource to ViewModel Property
posted

Hi I Couldn't find way to Bind XamPieChart ItemsSource to my view model Property. Suppose we have ViewModel

namespace SomeNameSpace

{

     public class DataItem

    {
        public string Label { get; set; }
        public double Value { get; set; }
    }

    public class Data : ObservableCollection<DataItem>
    {
        public Data()
    {
        Add(new DataItem { Label = "Item 1", Value = 5 });
        Add(new DataItem { Label = "Item 2", Value = 6 });
        Add(new DataItem { Label = "Item 3", Value = 3 });
        Add(new DataItem { Label = "Item 4", Value = 7 });
        Add(new DataItem { Label = "Item 5", Value = 5 });
    }
}

public class MyViewModel
{

        public Data DataToBind { get; set; }

}

How can I Bind ItemsSource to DataToBind?