J'ai des cases à cocher (où content = nom de la base de données). Dans metchod checkbox_checked im essayant d'ajouter ColumnSeries à wpf Chart, mais recevant toujours l'erreur: "La référence d'objet n'est pas définie sur une instance d'un objet."Erreur lors de l'ajout d'ItemsSource à ColumnSeries dans le graphique wpf
Voici le code XAML:
<DVC:Chart Canvas.Top="80" Canvas.Left="10" Name="wykres1" Background="LightSteelBlue">
</DVC:Chart>
et code-behind:
CheckBox c = (CheckBox)sender;
ColumnSeries b = new ColumnSeries();
b.Title = c.Content.ToString();
b.ItemsSource = null;
b.ItemsSource =
new KeyValuePair<string, int>[]{
new KeyValuePair<string, int>("Project Manager", 12),
new KeyValuePair<string, int>("CEO", 25),
new KeyValuePair<string, int>("Software Engg.", 5),
new KeyValuePair<string, int>("Team Leader", 6),
new KeyValuePair<string, int>("Project Leader", 10),
new KeyValuePair<string, int>("Developer", 4) };
wykres1.Series.Add(b);
categoryList.Add(c.Tag.ToString());
Tout le monde peut aider? :)