/// <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="OhlcSeriesBase"/> instance.</exception> protected override ChartSeries CreateInstanceCore(object context) { OhlcSeriesBase series = base.CreateInstanceCore(context) as OhlcSeriesBase; if (series == null) { throw new InvalidOperationException("Expected Ohlc series instance."); } string openPath = this.OpenPath; if (!string.IsNullOrEmpty(openPath)) { series.OpenBinding = new PropertyNameDataPointBinding(openPath); } string highPath = this.HighPath; if (!string.IsNullOrEmpty(highPath)) { series.HighBinding = new PropertyNameDataPointBinding(highPath); } string lowPath = this.LowPath; if (!string.IsNullOrEmpty(lowPath)) { series.LowBinding = new PropertyNameDataPointBinding(lowPath); } string closePath = this.ClosePath; if (!string.IsNullOrEmpty(closePath)) { series.CloseBinding = new PropertyNameDataPointBinding(closePath); } string categoryPath = this.CategoryPath; if (!string.IsNullOrEmpty(categoryPath)) { series.CategoryBinding = new PropertyNameDataPointBinding(categoryPath); } return(series); }
private static void OnCloseBindingChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { OhlcSeriesBase presenter = d as OhlcSeriesBase; (presenter.dataSource as OhlcSeriesDataSource).CloseBinding = e.NewValue as DataPointBinding; }