MVVM Context & Row doubleclick functionality

Thread is closed for posting
3 posts, 0 answers
  1. k f
    k f avatar
    109 posts
    Member since:
    Jun 2006

    Posted 06 Apr 2010 Link to this post


    RadControls version

    Q1 2010        

    .NET version

    .Net 3.5    

    Visual Studio version


    programming language


    browser support

    all browsers supported by RadControls

    The attached code demonstrates how to create a MVVM app with a RadGridView with right click Context Menu functionality as well as the ability to double click a row and have it fire a command in the ViewModel.

    A full write up of this using Prism as well as MVVM will be listed at Go to the Training (Prism) category, Lesson 9.

    In short, there is an assembly named WPFMVVMPrism which is based of the Cinch Framework but also includes some other code.

    This demonstrates how you can right click on a row and display a Contextmenu and select a menuItem and have it pass the CurrentItem back to the ViewModel.

    Also, it allows you to double click a row and have the row Item passed back to your viewModel.

  2. k f
    k f avatar
    109 posts
    Member since:
    Jun 2006

    Posted 09 Apr 2010 Link to this post

    Updated the sample to use the PreviewMouseRightClickDown event.  Also, I was advised that the IsSelected command will be deprecated so fixed the code in this version.
  3. Anderson
    Anderson avatar
    16 posts
    Member since:
    Feb 2008

    Posted 18 Aug 2010 Link to this post

    I'm having a little trouble with the double-click functionality.  I'd like to limit it to when the user just double-clicks a row and not anywhere in the grid, like you have here.  As an example, click to select a row, and then try double-clicking on a column header.

    Nevermind. I found this in another one of your posts:

    private void RGV_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
        e.Handled = ((FrameworkElement)e.OriginalSource).ParentOfType<GridViewRow>() == null;
Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.