chart.DefaultView.ChartArea.SelectionChanged handler not working in a particular case

2 posts, 0 answers
  1. Chris
    Chris avatar
    34 posts
    Member since:
    Jul 2011

    Posted 25 Oct 2011 Link to this post


    First let me setup the scenario we have:


    • We have a telerik grid on the left and then a tabbed view on the right which either shows a telerik grid or a telerik chart
    • Clicking on a row on the grid on the left updates the tabs on the right to show more detailed information about the clicked row (note that it will update both the right grid (by setting grid.ItemsSource) and the right chart (by setting chart.ItemsSource) at the same time)
    • The grid and chart on the right are essentially showing the same information just in different formats.  You can also click on the row in the right grid and it autoselects the relevent datapoint in the right chart (even though its not visible at the time because the right grid is showing).  And vice versa such that clicking on a datapoint on the right chart will update the selected row in the right grid.

    The following steps work fine when clicking through the UI:

    • Click on a row in the left grid - it updates the right grid which shows first of all (the right chart is currently hidden)
    • Show the right chart (switch tab)
    • Show the right grid again (switch tab)
    • Click on a row in the right grid
    • Switch to the chart and the relevant datapoint has been selected

    Here's what doesn't work:

    • Click on a row in the left grid - updates the right grid as per above
    • Show the right chart
    • Show the right grid again
    • Click on a different row in the LEFT grid (this will reset the ItemsSource of both the right grid and right chart)
    • Click on a row in the right grid
    • Switch to the chart - BUT the relevant datapoint has NOT been selected
    • BUT - Show the right grid again and click on a different row in the right grid
    • Switch back to the chart again - this time the relevant datapoint has been selected

    So it seems that until the updated right chart is made visible, the datapoint is not selected.

    We have debugged through the code and found the failure in the following code flow:

    • From our ViewModel for the Chart we have a handler function that captures that it needs to update the selected datapoint when the sibling grid has been clicked on (the sibling is the right grid in this case)
    • This function calls through to a View function (code behind for the XAML that's got the chart in)
    • This view function then calls chart.DefaultView.ChartArea.SelectItem(selectedDataPoint)
    • Which then hits our handler for the telerik event chart.DefaultView.ChartArea.SelectionChanged
    • This has the ChartSelectionChangedEventArgs param as expected
    • In the UI steps that do work the AddedItems member of the param has an item in (the newly selected datapoint) and everything works fine
    • Whereas in the UI steps that don't work the AddedItems member of the param is empty - even though a valid datapoint was passed into the call to chart.DefaultView.ChartArea.SelectItem(selectedDataPoint) above

    Have you seen this problem before at all and is there a known fix for it?



  2. Nikolay
    Nikolay avatar
    397 posts

    Posted 28 Oct 2011 Link to this post

    Hello Chris,

    Your scenario seems similar to the one from this help topic, so you may have look at it as well. However, it is difficult for us to determine the cause for the issues you've encountered without having a look at your code. Would it be possible to open a support ticket and send us a sample runnable application, which demonstrates the problems, so that our developers could debug locally and provide a solution.

    Best wishes,
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Back to Top