private void ProcessCategoryData() { _categoryValues.Clear(); if (this.DataSource != null && !string.IsNullOrEmpty(CategoryValueMemberPath)) { BindingEvaluator eval = new BindingEvaluator(CategoryValueMemberPath); foreach (object dataItem in this.DataSource) { _categoryValues.Add(eval.Eval(dataItem).ToString()); } } }
private void SetData() { titles.Clear(); values.Clear(); if (!string.IsNullOrEmpty(TitleMemberPath) && !string.IsNullOrEmpty(ValueMemberPath)) { BindingEvaluator titleEval = new BindingEvaluator(TitleMemberPath); BindingEvaluator valueEval = new BindingEvaluator(ValueMemberPath); foreach (object dataItem in this.DataSource) { titles.Add(titleEval.Eval(dataItem).ToString()); values.Add(Convert.ToDouble(valueEval.Eval(dataItem))); if (dataItem is INotifyPropertyChanged) { (dataItem as INotifyPropertyChanged).PropertyChanged -= OnDataSourceItemPropertyChanged; (dataItem as INotifyPropertyChanged).PropertyChanged += new PropertyChangedEventHandler(OnDataSourceItemPropertyChanged); } } total = values.Sum(); } }