Home Forums WPF controls Xceed DataGrid for WPF Mouse events for datagrid rows?

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

    How does one register mouse events for row items? In particular, I want to be able to click or double click a row and it will popup a window displaying information with that row’s data… something like that. Thanks.

    Imported from legacy forums. Posted by Brad (had 2339 views)

    Xceed Support
    Member
    Post count: 5658

    Somewhere in your Initialization Code, you should place this statement:

    EventManager.RegisterClassHandler( typeof( DataRow ), DataRow.MouseDoubleClickEvent, new MouseButtonEventHandler( OnDataRowMouseDoubleClick ) );

    Then, you can handle the event as any other RoutedEvent:

    <code>
    private void OnDataRowMouseDoubleClick( object sender, MouseButtonEventArgs e )
    {
    DataRow row = sender as DataRow;

    if(row != null)
    {
    MessageBox.Show( “DoubleClick on DataRow: ” + row.Cells[ 0 ].Content.ToString() );
    }
    }
    </code>

    Imported from legacy forums. Posted by Jenny [Xceed] (had 349 views)

    User (Old forums)
    Member
    Post count: 23064

    A read-only cell doesn’t seem to fire MouseDoubleClick. A read-write cell will if you double click on the editor, but won’t before then. MouseUp fires normally, though.

    Imported from legacy forums. Posted by mkb137 (had 3459 views)

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