/// <summary> /// Core entry point for creating the <see cref="ChartSeries" /> type defined by this descriptor. Allows inheritors to provide custom implementation. /// </summary> /// <param name="context">The context (this is the raw data collection or the data view model) for which a <see cref="ChartSeries" /> needs to be created.</param> /// <exception cref="System.InvalidOperationException">The base implementation fails to create a valid <see cref="CategoricalSeries"/> instance.</exception> protected override ChartSeries CreateInstanceCore(object context) { CategoricalSeriesBase series = base.CreateInstanceCore(context) as CategoricalSeriesBase; if (series == null) { throw new InvalidOperationException("Expected Categorical series instance."); } string valuePath = this.ValuePath; if (!string.IsNullOrEmpty(valuePath)) { series.ValueBinding = new PropertyNameDataPointBinding(valuePath); } string categoryPath = this.CategoryPath; if (!string.IsNullOrEmpty(categoryPath)) { series.CategoryBinding = new PropertyNameDataPointBinding(categoryPath); } return(series); }
private static void OnCategoryBindingChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { CategoricalSeriesBase presenter = d as CategoricalSeriesBase; (presenter.dataSource as CategoricalSeriesDataSourceBase).CategoryBinding = e.NewValue as DataPointBinding; }