1) When I open my application and click the "buttonFacture" in MainPage.xaml, columns are empty in MainFacturePage.xaml
<syncfusion:ColumnSeries ItemsSource="{Binding Facture}"
XBindingPath="Annee"
YBindingPath="Montant"
Label="Factures en €">
<syncfusion:ColumnSeries.AdornmentsInfo>
<syncfusion:ChartAdornmentInfo ShowConnectorLine="True"
ConnectorHeight="10"
ConnectorRotationAngle="90"
ShowLabel="True"
LabelRotationAngle="45"
LabelPosition="Outer"/>
</syncfusion:ColumnSeries.AdornmentsInfo>
</syncfusion:ColumnSeries>
public MainFacturePage()
{
this.InitializeComponent();
}
public class FacturesAnnuelle
{
public string Annee { get; set; }
public double Montant { get; set; }
}
public static ObservableCollection<FacturesAnnuelle> Facture { get; set; }
public class ViewModel
{
public ViewModel()
{
Facture = new ObservableCollection<FacturesAnnuelle>();
Facture.Add(new FacturesAnnuelle() { Annee = "2010", Montant = 100.24 });
Facture.Add(new FacturesAnnuelle() { Annee = "2011", Montant = 100.09 });
Facture.Add(new FacturesAnnuelle() { Annee = "2012", Montant = 100.92 });
Facture.Add(new FacturesAnnuelle() { Annee = "2013", Montant = 100.48 });
Facture.Add(new FacturesAnnuelle() { Annee = "2014", Montant = 100.07 });
Facture.Add(new FacturesAnnuelle() { Annee = "2015", Montant = 100.88 });
Facture.Add(new FacturesAnnuelle() { Annee = "2016", Montant = 0 });
Facture.Add(new FacturesAnnuelle() { Annee = "2017", Montant = 0 });
Facture.Add(new FacturesAnnuelle() { Annee = "2018", Montant = 0 });
Facture.Add(new FacturesAnnuelle() { Annee = "2019", Montant = 0 });
Facture.Add(new FacturesAnnuelle() { Annee = "2020", Montant = 0 });
}
}
2) If I do not put "public ObservableCollection<FacturesAnnuelle> Facture { get; set; }" in static, i have this issue : An object reference is required for , method, or property or the non-static field "MainFacturePage.Facture"