Reorder Items in Context Menu and Update GridView Ordering

2 Answers 18 Views
ContextMenu GridView
Marios
Top achievements
Rank 1
Iron
Marios asked on 07 Feb 2022, 02:49 PM

Hello,

I need a way to Drag & Drop an Item from the Context Menu and then GridView Columns to reordered based on the Context Menu Items ordering. This is for a WPF application.

As I understood this is not supported, I am writing here in any case I just didn't find the solution.

 

Thank you !!

2 Answers, 1 is accepted

Sort by
0
Stenly
Telerik team
answered on 10 Feb 2022, 01:59 PM

Hello Marios,

Achieving the wanted result would using the RadContextMenu control will be quite tricky to implement. Alternatively, you could try to open, for example, a Popup or a Window element, and inside it to display a ListBox element with the items that are present inside the RadContextMenu menu. Depending on the reorder of the items, you could modify the DisplayIndex property of each column. However, implementing such logic would not be straightforward, as it is a custom requirement specific to the project you are working on.

With that said, I hope the provided information is of help to you.

Regards,
Stenly
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Marios
Top achievements
Rank 1
Iron
answered on 10 Feb 2022, 02:51 PM

Hello Stenly,

Thank you for your answer.

I created a RapDropDownButton with a RadListBox inside it and I added GridView.Columns as RadListBox.Items. Then I created a CustomControl and implemented ListBoxDragDropBehavior in order to override Drop() method and get the state.InsertIndex as described here.

How can I get this index in the View .cs file in order to change the column displayIndex of the GridView?

Stenly
Telerik team
commented on 15 Feb 2022, 01:00 PM

I generally understand the scenario, however, in order to prevent any misunderstandings, would it be a problem for you to isolate this into a sample project, so I can debug it and try to come up with a suitable solution?
Tags
ContextMenu GridView
Asked by
Marios
Top achievements
Rank 1
Iron
Answers by
Stenly
Telerik team
Marios
Top achievements
Rank 1
Iron
Share this question
or