Nov 24th, 2011, 08:23 AM
How to pass parameters from other controls to eventhandler in WPF
I have a contentcontrol that holds an image control. Contentcontrol content is binded to a currently selected row in datagrid which is binded to a dataset table.
I have an eventhandler for clicking the image that should add an image to the datatable to the row corresponding the selected row in the datagrid at the time the image was clicked.
How can I pass the currently selected row in the datagrid to the click eventhandler so that I could determine which row in the datatable I should add the image?
Can I get it through the default sender or e parameters somehow?
Mar 3rd, 2012, 02:56 PM
Re: How to pass parameters from other controls to eventhandler in WPF
You could use an eventhandler in the row of the grid OR you could read the value of the datagrid.selectedrow (the datagrid is the sender object):
int rownr = ((DataGrid)sender).SelectedIndex;
Click Here to Expand Forum to Full Width
Survey posted by VBForums.