Results 1 to 2 of 2
  1. #1

    Thread Starter
    Join Date
    Dec 2010

    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?

  2. #2
    Frenzied Member Lightning's Avatar
    Join Date
    Oct 2002

    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;
    VB6 & C# (WCF LINQ) mostly

    If you need help with a WPF/WCF question post in the NEW WPF & WCF forum and we will try help the best we can

    My site

    My blog, couding troubles and solutions

    Free online tools

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts


Click Here to Expand Forum to Full Width

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.