Asked By Michael Detras on 07-Oct-10 02:33 AM
Hi, the reason why the SelectedValue becomes null is because the ItemsSource of the DataGrid is changed when you click on the Next button. The currently selected item won't be found in the new ItemsSource. Either you check if the SelectedValue is null or set a default selection (like the first item) before you call int.parse().

Scrolling in WPF Toolkit’s Column Chart - wanlan meng replied to Michael Detras on 25-Sep-13 05:10 AM

Hi,Michael Detras
I read the article you wrote 

http://www.nullskull.com/a/1487/scrolling-in-wpf-toolkits-column-chart.aspx
Now I want to add more data to the Chart,but the operating results are not ideal.Before the addition of XAML:
<Window x:Class="WPFToolkitChartScrollDemo.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="clr-namespace:WPFToolkitChartScrollControls;assembly=WPFToolkitChartScrollControls"
    xmlns:charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
    Title="MainWindow" Height="400" Width="500">
    <Grid>
        <charting:Chart>
            <charting:Chart.Series>
                <controls:ScrollableColumnSeries
                    IndependentValueBinding="{Binding Name}"
                    DependentValueBinding="{Binding Quantity}"
                    ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Window}, Path=Parts}"/>
            </charting:Chart.Series>
        </charting:Chart>
    </Grid>
</Window>

And After the additon of XAML:
<Window x:Class="WPFToolkitChartScrollDemo.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="clr-namespace:WPFToolkitChartScrollControls;assembly=WPFToolkitChartScrollControls"
    xmlns:charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
    Title="MainWindow" Height="400" Width="500">
    <Grid>
        <charting:Chart>
            <charting:Chart.Series>
                <controls:ScrollableColumnSeries
                    IndependentValueBinding="{Binding Name}"
                    DependentValueBinding="{Binding Quantity}"
                    ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Window}, Path=Parts}"/>
                <controls:ScrollableColumnSeries
                    IndependentValueBinding="{Binding Name}"
                    DependentValueBinding="{Binding Quantity}"
                    ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Window}, Path=Parts2}"/>

            </charting:Chart.Series>
        </charting:Chart>
    </Grid>
</Window>                                                                                                                                                                                                                      

When the scroll, only the series[0] data series change, while series[1] did not change. Can you help me? Thanks in advance!