Home Forums WPF controls Xceed DataGrid for WPF how to get the data in cell when selected

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #23922 |

    We have used wpf xceed grid and filled with the data set.
    now we required the value of the row selected, as got the mouse single click event. but we are not getting the value of the selected row.

    we have used EventManager for creating the mouseclick event :
    “EventManager.RegisterClassHandler(typeof(Xceed.Wpf.DataGrid.DataGridControl), Xceed.Wpf.DataGrid.DataGridControl.MouseLeftButtonUpEvent, new MouseButtonEventHandler(OnDataRowMouseDoubleClick));”

    And we have created the specified method for the event as :

    private void OnDataRowMouseDoubleClick(object sender, MouseButtonEventArgs e)
    {
    DataRow row = sender as DataRow;
    string sa = row.Table.Columns[0].ColumnName.ToString();
    }

    by using the above method we are not getting the selected row.

    Imported from legacy forums. Posted by pranav (had 636 views)

    User (Old forums)
    Member
    Post count: 23064

    Perhaps you want to look at the Preview event, if you haven’t alread check out the tunneling and bubbling nature of the Preview and Regular RoutedUIEvents in WPF.

    Check out the WPF Wiki 🙂
    http://wpfwiki.com/WPF%20FAQ%20Index.ashx#BERoutedEvents

    Note that the DataGridControl itself has a CurrentItem and SelectedItem property which are not always the same thing:

    http://doc.xceedsoft.com/products/XceedWpfDataGrid/Xceed.Wpf.DataGrid~Xceed.Wpf.DataGrid.DataGridControl~CurrentItem.html

    Also use Snoop to check out the events so you can see what’s going on.
    http://www.blois.us/Snoop/

    Imported from legacy forums. Posted by Richard (had 2997 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.