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

DoubleClick on row doesn't work

5 Answers 424 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 06 Dec 2011, 07:46 PM
Hi,

I have following markup for my RadGridView:

<telerik:RadGridView  
    ItemsSource="{Binding PagedSource, ElementName=radDataPager}"
    SelectedItem="{Binding Path=SelectedAccount, Mode=TwoWay}"
    IsBusy="{Binding IsSearchActive}"
    IsReadOnly="True"
    CanUserDeleteRows="False"
    CanUserInsertRows="False"
    ShowGroupPanel="False"
     
    AutoGenerateColumns="False">
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding AccountNumber}" Header="Account #" />
        <telerik:GridViewDataColumn DataMemberBinding="{Binding FullName}" Header="Name" />
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Email}" Header="Email" />
        <telerik:GridViewDataColumn DataMemberBinding="{Binding OrganizationName}" Header="Organization" />
    </telerik:RadGridView.Columns>
    <telerik:RadGridView.InputBindings>
        <MouseBinding Gesture="LeftDoubleClick" Command="{Binding DisplayViewCommand}" />
        <KeyBinding Key="Enter" Command="{Binding DisplayViewCommand}" />
    </telerik:RadGridView.InputBindings>
     
    <telerik:RadGridView.RowStyle>
        <Style>
             
        </Style>
    </telerik:RadGridView.RowStyle>
 
</telerik:RadGridView>

Now, when I hit "Enter" key the DisplayViewCommand is invoked in my ViewModel as expected.
But the DoubleClick doesn't work for some reason. (BTW: if I am double click on the Grid Header (the empty cell in top right corner) the command is triggered but of course I expect that current row double click should work also)


What I am doing wrong?


5 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 07 Dec 2011, 07:26 AM
Hello Michael,

Actually, double click in handled internally by RadGridView. I would suggest to try working with RowActivated event that would be fired both on hitting Enter key and double-clicking on a row. You can create an EventTrigger and execute the command in your ViewModel for example.

 

Best wishes,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Michael
Top achievements
Rank 1
answered on 07 Dec 2011, 03:15 PM
Thanks for the prompt response. Do you have sample code that demostrate this approach?
I have put following code but it executes the command from when cliked anywere on the grid (even on the header).
How to make it react only on doubleclick on the row?
<telerik:RadGridView>
    <telerik:RadGridView.Columns>
    <!-- ommited for briefity -->              
    </telerik:RadGridView.Columns>
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="RowActivated" >
            <i:InvokeCommandAction Command="{Binding DisplayViewCommand}" />
        </i:EventTrigger>
    </i:Interaction.Triggers>
    <telerik:RadGridView.InputBindings>
        <KeyBinding Key="Enter" Command="{Binding DisplayViewCommand}" />
    </telerik:RadGridView.InputBindings>
</telerik:RadGridView>
0
Maya
Telerik team
answered on 08 Dec 2011, 07:52 AM
Hello Michael,

What you can try is to pass the arguments of the event to the command, check the underlying item (through OriginalSource property) and verify whether its parent (using ParentOfType<T>() extension method) is GridViewRow. 
I would suggest to take a look at this Toolkit for additional reference. You can also take a look at this forum thread for a sample project illustrating the implementation of the suggested approach.
Let me know whether this corresponds to your requirements.

Greetings,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Kareem Azzouny
Top achievements
Rank 1
answered on 24 Jan 2012, 10:56 AM
there is a problem here in double click that when you use the rowactivaed it throw exception if you double click in the radgirdview header 

if there is any one has solve for this issue i will be appreciated 

Regards
0
Vlad
Telerik team
answered on 24 Jan 2012, 10:58 AM
Hello,

 Can you post the exception stacktrace and your grid version? 

Regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Michael
Top achievements
Rank 1
Answers by
Maya
Telerik team
Michael
Top achievements
Rank 1
Kareem Azzouny
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or