This is a migrated thread and some comments may be shown as answers.

Filtering and Row Double click

8 Answers 237 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Marcus Lambert
Top achievements
Rank 1
Marcus Lambert asked on 22 Sep 2009, 08:55 PM
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

8 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 23 Sep 2009, 09:05 AM
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.
0
Marcus Lambert
Top achievements
Rank 1
answered on 23 Sep 2009, 12:49 PM
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
0
Stefan Dobrev
Telerik team
answered on 25 Sep 2009, 10:24 AM
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.
0
Nathan J Pledger
Top achievements
Rank 2
answered on 15 Oct 2009, 03:23 PM
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?


0
Stefan Dobrev
Telerik team
answered on 21 Oct 2009, 06:49 AM
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.
0
Marcin
Top achievements
Rank 1
answered on 07 Jan 2010, 12:58 PM
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?
0
Vlad
Telerik team
answered on 11 Jan 2010, 02:48 PM
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.
0
John
Top achievements
Rank 1
answered on 10 Jul 2012, 01:34 AM
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
Tags
GridView
Asked by
Marcus Lambert
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Marcus Lambert
Top achievements
Rank 1
Stefan Dobrev
Telerik team
Nathan J Pledger
Top achievements
Rank 2
Marcin
Top achievements
Rank 1
Vlad
Telerik team
John
Top achievements
Rank 1
Share this question
or