(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
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!
Nik
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
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
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!
Nik
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
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
I am attaching an example of how you can achieve the behavior.
Hope it helps!
Nik
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
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.