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

Select full row issues

6 Answers 204 Views
GridView
This is a migrated thread and some comments may be shown as answers.
dani
Top achievements
Rank 1
dani asked on 05 Feb 2013, 06:40 PM
Hi,
(Wrongly posted on gant forum)

I want to create this behavior:

I want to be able to select only full lines, and act on double click on the line -

currently I have 2 problems with this code:

<telerik:RadGridView Name="gdTestRecords" DockPanel.Dock="Bottom" AutoGenerateColumns="False" ClipboardCopyMode ="All" MouseDoubleClick="gdTestRecords_MouseDoubleClick" SelectionMode="Extended" SelectionUnit="FullRow" MaxHeight="600" ScrollViewer.VerticalScrollBarVisibility="Visible">


1, when I double click inside the line - it selects the cell and not the line - I can only choose the line by clicking on the edge of the line.
    this code will return null: RecordType st = ((FrameworkElement)e.OriginalSource).DataContext as RecordType (unless I click on the edge)
2. when I click on the vertical scroll bar more than 2 times - it acts like selecting a cell ! - I need to interpreting clicking on scroll bar as clicking on the grid surface and not clicking inside the line.

How can I fix this ?

6 Answers, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 06 Feb 2013, 09:35 AM
Hello Dani,

I am not sure I understand correctly your first problem. What exactly do you mean by it selects the cell and not the line ? Maybe a screenshot could better illustrate what is your exact problem.

As to the second issue, the DoubleClickEvent is fired because the subscription is for the GridView and respectively all of its child elements. You have to check if the Source of the event is valid for execution of your custom logic in order to achieve a correct scenario.

Hope this helps! Looking forward to hearing from you! 

Kind regards,
Nik
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
dani
Top achievements
Rank 1
answered on 06 Feb 2013, 09:49 AM

When I check what I get back from double clicking;

RecordType st = ((FrameworkElement)e.OriginalSource).DataContext as RecordType

I get null when clicking inside the grid and I get the row object only when clicking on the side arrow of a grid line.
I want that wherever the user clicks inside the gtid row to get yhe full row object and not the cell.

Dani
0
Nick
Telerik team
answered on 06 Feb 2013, 09:57 AM
Hello Dani,

Great. The issue here is that the double click event is fired to late. Meaning the row has already gotten in edit mode, and you get the event with source the cell in edit mode. 
To workaround the issue, you have to use the PreviewMouseDoubleClick event, or use the approach shown in this example.

Hope this helps! 

Greetings,
Nik
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
dani
Top achievements
Rank 1
answered on 07 Feb 2013, 12:30 PM
This is a silverlite example.
Is it the same as WPF ?
I didn't see any PreviewMouseDoubleClick handling there. it selects the cell.....
I need to get the row object wherever I click anywhere inside the row, and filter click events on the scroll bar.
I think these are 2 issues here.
(the PreviewMouseDoubleClick will help filter the scroll bar I guess, don't know how yet...)
and how can I get the row object once clicking on a cell inside ?

Thanks,
Dani

0
Accepted
Nick
Telerik team
answered on 12 Feb 2013, 09:49 AM
Hello Dani,

I am attaching an example of how you can achieve the behavior.

Hope it helps! 

All the best,
Nik
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
dani
Top achievements
Rank 1
answered on 12 Feb 2013, 01:15 PM
Thanks,
That's what I've needed, I've tried before but I wasn't aware that ParentOfType is telerik function
Anyway  - it still enters edit mode after returning from my double click but I'll find how to fix this.
Dani.
Tags
GridView
Asked by
dani
Top achievements
Rank 1
Answers by
Nick
Telerik team
dani
Top achievements
Rank 1
Share this question
or