RadGridView - Drag and Trend Behavioiur

1 Answer 93 Views
GridView
Scott
Top achievements
Rank 1
Scott asked on 12 Oct 2022, 05:19 PM

I am looking to mimic Spreadsheet behaviour where a user selects two or more cells in a row and then the user drags to the right to trend and fill in additional values according to the linear trend. 

How could I go about overloading the RadGridView to provide behaviour like this? I have seen posts about using CustomAdorner to give a thick line around the selected cells. What would be required to change the mouse cursor when the "Think" line around the selected cells is hovered over, and capture the dragged-over cells when the user executes the drag operation?

Any help you can provide would be much appreciated.

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 17 Oct 2022, 09:45 AM

Hi Scott,

You can consider using the RadSpreadsheet for WPF control.

If you need to use the GridView, then you can enable drag-to-select by setting the SelectionMode property to Extended and the DragElementAction to Select.

<telerik:RadGridView SelectionMode="Extended"  DragElementAction="Select"/>

To enable dragging of the selected rows and then moving/copying them to another cell range, you will need to write custom code. You can find some code showing custom drag and drop in the following SDK sample: https://github.com/telerik/xaml-sdk/tree/master/GridView/DragDropWithLines. The example doesn't show your exact requirement, but you can use it as a reference for your own implementation.

To change the cursor during drag/drop, you can use the GiveFeedback event of DragDropManager.

I hope this information.

Regards,
Martin Ivanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
GridView
Asked by
Scott
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or