views:

289

answers:

0

Hello,

I have a silverlight datagrid which have as DataContext a list of SuiviCaBo(personnal object). I also have a chart with columnSeries.

My goal is when I click on a bar inside the chart, the line of the datagrid that match the information is highlighted and the right column is selected. I succeeded in hightling the row by using the following code.

C# code

    void serie1_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        SuiviCaBo suiviCaSelected = ((ColumnSeries)sender).SelectedItem as SuiviCaBo;
        int count = 0;
        foreach (SuiviCaBo item in GridSuiviCa.ItemsSource)
        {
            if (suiviCaSelected.Entite == item.Entite)
            {
                GridSuiviCa.SelectedIndex = count;
                SuiviCaBo test = (SuiviCaBo)GridSuiviCa.SelectedItem;

            }
            count++;
        }
    }

My problem is that now, I want to select a specific column in that row. By default, if I select a row by clicking on it, it highlight the row with specific color and the column I clicked in with another color. When i run my code, I click on the column in the chart, the right row in datagrid get selected but if before I clicked on another column I will stay on the previous selected cell.

I tried to access to the column but we can't, we can only access data through the ItemSource. Result from SelectedItem give me only a SuiviCaBo object on which I can't select anything.

I made some research but I'm stuck at finding on how I can select/set focus on a specific cell from my highlighted row.

I hope my explanation was clear enough.

Thanks in advance for any lead for solving my problem.

Happy programming!

Luuna.