1
votes

I have a DataGrid bounded to OservableCollection populated cols and rows dynamically. The DataGrid's row has couple of buttons. On each button a method is called (have implemented AddHandler while generating columns).

In the handler method, I can get which row was selected. I want to know the button of which column was selected. Based on that only I can take action and open respective windows.

How do I know which button of the row was selected ?

1
different handlers? or you can check the sender ( or sender's datacontext) - kuzditomi

1 Answers

1
votes

I get the column using :

int col = myDataGrid.CurrentCell.Column.DisplayIndex;
int row = seivesTorGrid.SelectedIndex; 

Based on this I am able to code respective actions.