0

I have a dxgrid with columns, the first column containing a textblock with a context menu set. For handling the context menu button events, i need to access the data context of the row, and that's how i do it:

private void ContextMenuButton_Click(object sender, RoutedEventArgs e)
{
    MenuItem menuItem = (MenuItem)e.Source;
    ContextMenu menu = (ContextMenu)menuItem.Parent;
    MyData ThisData = ((MyData)(((GridCellDataAlias)(((FrameworkElement)
        (menu.PlacementTarget)).DataContext)).RowData.Row));

    // Now I do what should with the data here
}

Now what I like to do is to have access to the other cell in the row (column #2), so i could refresh it visually. How can i access it? To refresh I'm going to try this code:

Action EmptyDelegate = delegate() { };
MyEntireRow.Dispatcher.Invoke(DispatcherPriority.Render, EmptyDelegate); 

Thanks in advance.

iXed
  • 157
  • 2
  • 3
  • 9

1 Answers1

1

Could you use HitInfo to calculate which row you clicked?

See here: http://documentation.devexpress.com/#WPF/clsDevExpressXpfGridTableViewHitInfotopic

Then you can get that row from the grid and get the second column.

Yuf
  • 610
  • 2
  • 6
  • 14
  • It is for the WPF DevExpress grid. I don't know if there is one for the normal WPF grid, but you can check this post: http://stackoverflow.com/questions/5121186/datagrid-get-selected-rows-column-values – Yuf Aug 08 '11 at 13:51