Esempio n. 1
0
        /// <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="ScatterPointSeries"/> instance.</exception>
        protected override ChartSeries CreateInstanceCore(object context)
        {
            ScatterPointSeries series = base.CreateInstanceCore(context) as ScatterPointSeries;

            if (series == null)
            {
                throw new InvalidOperationException("Expected Scatter series instance.");
            }

            string xValuePath = this.XValuePath;

            if (!string.IsNullOrEmpty(xValuePath))
            {
                series.XValueBinding = new PropertyNameDataPointBinding(xValuePath);
            }

            string yValuePath = this.YValuePath;

            if (!string.IsNullOrEmpty(yValuePath))
            {
                series.YValueBinding = new PropertyNameDataPointBinding(yValuePath);
            }

            return(series);
        }
Esempio n. 2
0
        private static void OnYValueBindingChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ScatterPointSeries presenter = d as ScatterPointSeries;

            (presenter.dataSource as ScatterSeriesDataSource).YValueBinding = e.NewValue as DataPointBinding;
        }