MVVM Context & Row doubleclick functionality

Thread is closed for posting
3 posts, 0 answers
  1. BF42EC85-B935-4155-BBB8-2DF2BAB6B5E8
    BF42EC85-B935-4155-BBB8-2DF2BAB6B5E8 avatar
    109 posts
    Member since:
    Jun 2006

    Posted 06 Apr 2010 Link to this post

    Requirements

    RadControls version

    Q1 2010        

    .NET version

    .Net 3.5    

    Visual Studio version

    2008

    programming language

    C#

    browser support

    all browsers supported by RadControls


    PROJECT DESCRIPTION
    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 http://www.compositedevpatterns.com 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. BF42EC85-B935-4155-BBB8-2DF2BAB6B5E8
    BF42EC85-B935-4155-BBB8-2DF2BAB6B5E8 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. 38DA472A-568D-4D81-B3D9-E70B27143F4C
    38DA472A-568D-4D81-B3D9-E70B27143F4C 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.

    Edit:
    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.