private void OnBubbleDataListBoxSelectionChanged(object sender, SelectionChangedEventArgs e) { var series = this.DataChart.Series.FirstOrDefault(); if (series == null) { return; } if (e.AddedItems.Count > 0) { CategoryDataPoint selectedDataPoint = e.AddedItems[0] as CategoryDataPoint; CategoryDataRandomSample data = this.Resources["CategoryData"] as CategoryDataRandomSample; if (data != null) { foreach (CategoryDataPoint dataPoint in data) { if (dataPoint == selectedDataPoint) { series.ScrollIntoView(dataPoint); break; } } } } }
private void OnXAxisScrollSliderChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { CategoryXAxis xAxis = this.DataChart.Axes.OfType <CategoryXAxis>().First(); if (xAxis == null) { return; } int index = (int)e.NewValue; CategoryDataRandomSample data = xAxis.ItemsSource as CategoryDataRandomSample; if (data != null) { xAxis.ScrollIntoView(data[index]); } }