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

[Solved] Left mouse button on gridview

1 Answer 159 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tom Klein
Top achievements
Rank 1
Tom Klein asked on 29 Dec 2009, 03:36 PM
Im trying to catch the left mouse button event in the gridview so I can enable double clicking and open a popup window. I know the event args has a count of clicks and I can catch a double click event that way but my problem is that the rows and columns in the gridview don't seem to respond to the mouse button event.
 When I click on the sides of the gridview or on the header it catches it fine, but as soon as I click on a row it doesn't seem to catch it at all. Is there any way I can attach the left mouse button up event to the cells or rows of the gridview?
  I would prefer to be able to do it in xaml, I know I can use the rowcreating event to attach an eventhandler to each row as it is created but since Im using Prism and Commanding I would prefer to be able to use xaml, as I can then bind the event to a delegate in my view model.

If the last part doesn't make sense to you, all I need is to have the left mouse button up event to fire when clicking on a cell or row, and I want to be able to set it in xaml, not the code behind. Is this possible?

For some extra clarity, here is the code I have right now:

<telerikGrid:RadGridView x:Name="TasksGridView" 
            ItemsSource="{Binding Tests}" 
            DataContext="{Binding}" 
            AutoGenerateColumns="False" 
            IsReadOnly="True" 
            CommandBehavior:MouseUp.Command="{Binding MouseUpCommand}"
            <telerikGrid:RadGridView.Columns> 
                <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding Test1}" 
                      Header="Test1" /> 
                <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding Test2}" 
                      Header="Test2"/> 
                <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding Test3}" 
                      Header="Test3"/> 
                <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding Test4}" 
                      Header="Test4"/> 
                <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding Test5}" 
                      Header="Test5"/> 
            </telerikGrid:RadGridView.Columns> 
        </telerikGrid:RadGridView> 


(replaced some variables with dummy data)

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 04 Jan 2010, 07:56 AM
Hello Tom,

Please check this post for more info:
http://www.telerik.com/community/forums/silverlight/gridview/radgridview-mouse-event-handling-and-performance-issues-in-q3-2009.aspx

Sincerely yours,
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.
Tags
GridView
Asked by
Tom Klein
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or