Filtering and Row Double click

9 posts, 0 answers
  1. Marcus Lambert
    Marcus Lambert avatar
    41 posts
    Member since:
    Aug 2009

    Posted 22 Sep 2009 Link to this post

    Hi,

    Wonder if any body has answers about the grid and filtering it.

    1. I cant seem to find a double click row event? is there one ? {ok I found that there is a double click on the Cell}.

    2. Has any body done a grid filter and text box like in the samples using MVVM as the FilterDescriptors properties don't seem to be bindable.

    Thanks in advance

    Marcus
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 23 Sep 2009 Link to this post

    Hi Marcus Lambert,

    1) Silverlight does not provide such events. However, Telerik has created a couple of extensions that will let you overcome the limitations of the Silverlight platform. Here is how you can detect a double-click on a row:

    using System.Windows; 
    using System.Windows.Controls; 
    using Telerik.Windows.Controls.GridView; 
    using Telerik.Windows.Input; 
     
    namespace TicketID_242524_EditTriggers 
        public partial class MainPage : UserControl 
        { 
            public MainPage() 
            { 
                this.InitializeComponent(); 
     
                this.clubsGrid.ItemsSource = Club.GetClubs(); 
                this.clubsGrid.RowLoaded += OnClubsGridRowLoaded; 
            } 
     
            private static void OnClubsGridRowLoaded(object sender, RowLoadedEventArgs e) 
            { 
                Mouse.AddMouseUpHandler(e.Row, OnMouseUp); 
            } 
     
            private static void OnMouseUp(object sender, MouseButtonEventArgs args) 
            { 
                if (args.ClickCount == 2) 
                { 
                    var row = sender as GridViewRow; 
                    if (row != null
                    { 
                        var club = row.DataContext as Club; 
                        if (club != null
                        { 
                            MessageBox.Show("The row containing " + club.Name + " was double clicked!"); 
                        } 
                    } 
                } 
            } 
        } 

    I have attached a small sample project with the double click implemented.

    2) Currently you can do this only like it is shown in the examples.

    Kind regards,
    Ross
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
  4. Marcus Lambert
    Marcus Lambert avatar
    41 posts
    Member since:
    Aug 2009

    Posted 23 Sep 2009 Link to this post

    Thanks for that, is there a way to do it in xmal? as I am using MVVM

    What I have done is created a behavior for the double mouse click on the GridViewCell using Prisms Commanding interfaces.
    So would it be possible to define a Cell Datatemplate with this behavior or a style globally for the grid ?

    Marcus
  5. Stefan Dobrev
    Admin
    Stefan Dobrev avatar
    790 posts

    Posted 25 Sep 2009 Link to this post

    Hi Marcus,

    It should be possible to implement this behavior. You should just apply the style that is applying the behavior on each of the GridView's Column.CellStyle. If you don't want to do it manually you can create an attached behavior for RadGridView that is listening for Columns.CollectoinChanged and applying the new style to each new column.

    Hope this helps.

    Greetings,
    Stefan Dobrev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Nathan J Pledger
    Nathan J Pledger avatar
    95 posts
    Member since:
    Apr 2006

    Posted 15 Oct 2009 Link to this post

    Hi,

    I have also implemented this code and am finding that whenever the grid is redrawn (eg. it is switched away to another tab and back, or the grid is refreshed) the event is re-wired and this causes multiple double-clicks.

    Is there anyway to detect this and prevent it?


  7. Stefan Dobrev
    Admin
    Stefan Dobrev avatar
    790 posts

    Posted 21 Oct 2009 Link to this post

    Hi Nathan,

    You can subscribe to the SelectionChanged event of the TabControl and un-wire the mouse events when the selected tab is changed.

    All the best,
    Stefan Dobrev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  8. Marcin
    Marcin avatar
    28 posts
    Member since:
    Jan 2009

    Posted 07 Jan 2010 Link to this post

    Hi Ross,
    your double click example works with Q2 (2009.2.914.1030 trial), but unfortunatelly doesn't work with Q3 (2009.3.1103.1030 dev). Could you verify it?
  9. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 11 Jan 2010 Link to this post

    Hello Marcin,

    Please check this thread for more info how to achieve the same with Q3:
    http://www.telerik.com/community/forums/silverlight/gridview/radgridview-mouse-event-handling-and-performance-issues-in-q3-2009.aspx

    Kind regards,
    Vlad
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  10. John
    John avatar
    4 posts
    Member since:
    Dec 2011

    Posted 09 Jul 2012 Link to this post

    Man, I looked everywhere and could not find any solutions in the forums. So I am posting it in every thread that asks how to catch the row double-click. It would be nice if Telerik made it easy to find. This is so simple.
    VB.Net
    Private Sub dgObjects_RowActivated(sender As System.Object, e As Telerik.Windows.Controls.GridView.RowEventArgs) Handles dgObjects.RowActivated
            If Not dgObjects.SelectedItem Is Nothing Then
                MessageBox.Show("test")
            End If
        End Sub
Back to Top
DevCraft banner