Mouse double click

8 posts, 0 answers
  1. Zbigniew Kozłowski
    Zbigniew Kozłowski avatar
    60 posts
    Member since:
    Apr 2010

    Posted 02 Aug 2010 Link to this post

    Hi,
    how can i check if user double clicked on row? Because now double click works on everything, so if someone scroll the grid and double click on the row the event is fired, same when user double click on header column etc. I need to fire double click only on row. Also how can i make double click work only on left button? i checked in MouseButtonEventArgs e, i can see if it was left but i see only last click so i dont know if the first click was with right button or not.
  2. Tsvyatko
    Admin
    Tsvyatko avatar
    833 posts

    Posted 02 Aug 2010 Link to this post

    Hello Zbigniew Kozłowski,

    You can achieve this with two alternative approaches:
    - use celldoubleclick event (you need to check args.OriginalSource type to determine whether you are clicking on row, header or footer).
    - use row activated event

    Please check this example - http://demos.telerik.com/silverlight/#GridView/ClickEvents for more information.

    If you have any other issues or questions do not hesitate to contact us.

    Regards,
    Tsvyatko
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. JC
    JC avatar
    5 posts
    Member since:
    Oct 2010

    Posted 07 Nov 2010 Link to this post

    Hi,

    I tried the code from the link but I'm getting an error when compiling. Please see the attached screen cap. What's wrong with the code?

    Here's my code:

    using System;
    using System.ComponentModel;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    using Telerik.Windows.Controls.GridView;
      
    using System.Windows.Resources;
    using System.ComponentModel;
      
    namespace EMPR_Main.UserControls
    {
        public partial class SearchSVP : UserControl, INotifyPropertyChanged
        {
      
            private GridViewCellBase clickedCell;
      
            public GridViewCellBase ClickedCell
            {
                get
                {
                    return clickedCell;
                }
                set
                {
                    clickedCell = value;
                    if (this.PropertyChanged != null)
                    {
                        this.PropertyChanged(this, new PropertyChangedEventArgs("ClickedCell"));
                    }
                }
            }
        
            public SearchSVP()
            {
                InitializeComponent();
                rgrdResults.AutoGenerateColumns = false;
                rgrdResults.AddHandler(GridViewCellBase.CellDoubleClickEvent, new EventHandler<RoutedEventArgs>(OnCellDoubleClick), true);
            }
      
            private void OnCellDoubleClick(object sender, RoutedEventArgs args)
            {
                MessageBox.Show("test");
            }
      
      
            #region INotifyPropertyChanged Members
            public event PropertyChangedEventHandler PropertyChanged;
            #endregion
        }
    }

     

  5. Tsvyatko
    Admin
    Tsvyatko avatar
    833 posts

    Posted 08 Nov 2010 Link to this post

    Hello JC,

    You have passed RoutedEventArgs instead RadRoutedEventArgs arguments in the handler and method.

    Let me know if you have any further issues.

    All the best,
    Tsvyatko
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. JC
    JC avatar
    5 posts
    Member since:
    Oct 2010

    Posted 08 Nov 2010 Link to this post

    Got it. Thanks!

    I added a reference to the Telerik.Windows namespace. The sample code did not show that.
  7. Xavier Hutchinson
    Xavier Hutchinson avatar
    23 posts
    Member since:
    Nov 2009

    Posted 26 Apr 2011 Link to this post

    *deleted*
  8. Rene
    Rene avatar
    5 posts
    Member since:
    Mar 2011

    Posted 16 May 2011 Link to this post


    Hi Tsvyatko,

    Unfortunately the sample code does not work 100% to the time, specifically, double clicking a *column header* should not be considered as a valid section to click on.... at least that is my opinion.

    Is there any way that the sample code can be modified so that column headers are ignored too?

    Thanks.

  9. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 17 May 2011 Link to this post

    Hello Rene,

    The event will be fired for GridViewCellBase. If you do not want to perform the required actions on a GridViewHeaderCell, you may verify the type of the cell - whether it is a GridViewCell or GridViewHeaderCell - in the event handler and execute them only for the cells you want.
     

    Best wishes,
    Maya
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top
UI for WPF is Visual Studio 2017 Ready