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
370
Ho to databing XamChart?
posted

 

 

 

 

 

 

 

 

 

 

 

 

Hello, I want to bind a collection to a xamChart. My first attempt. Below is the xaml and the code behind and I am not seeing any chart after I run the application. What am I doing wrong?

Thanks

 

<Grid>

    <igCA:XamChart Name="xamChart1" DataContext="{Binding.}">

      <igCA:XamChart.Series>

        <igCA:Series ChartType="Bar" Fill="#FFD21717" Stroke="#FF000000" DataSource="{Binding Source=MothlyCharges}" Label="Monthly Total Charges" DataMapping="Lable=Month; Value=Amount">

        </igCA:Series>

     </igCA:XamChart.Series>

   </igCA:XamChart>

</Grid>

 

 

 

 

    public partial class MainWindow : Window

    {

        public MainWindow()

        {

            InitializeComponent();

            this.DataContext = new MV();

        }

    }

    public class MV

    {

        public MV()

        {

            MothlyCharges = new ObservableCollection<MonthlyCharges>();

            MothlyCharges.Add(new MonthlyCharges { Month = "Jan 2010", Amount = 213.99m });

            MothlyCharges.Add(new MonthlyCharges { Month = "Feb 2010", Amount = 1213.99m });

            MothlyCharges.Add(new MonthlyCharges { Month = "Mar 2010", Amount = 213.99m });

            MothlyCharges.Add(new MonthlyCharges { Month = "Apr 2010", Amount = 5213.99m });

        }

        public ObservableCollection<MonthlyCharges> MothlyCharges

        {

            get;

            set;

        }

 

    }

    public class MonthlyCharges

    {

        public string Month;

        public decimal Amount;

    }

 

 

 

Parents Reply Children
No Data