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

[Solved] Dragging a row from a RadGridView to a RadRichTextBox using the right mouse button

5 Answers 109 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Oliver
Top achievements
Rank 1
Oliver asked on 17 Jun 2011, 09:52 AM
I'm looking for suggestions on how to initiate a drag and drop operation from a gridview row using the right mouse button. So far my attempts have not been successful.

5 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 21 Jun 2011, 07:29 AM
Hello,

 Can you clarify why you cannot use normal drag in your case? 

Best wishes,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Oliver
Top achievements
Rank 1
answered on 21 Jun 2011, 07:32 AM
Because a normal drag operation using the left button also changes the selection which is not wanted in this case.
0
Milan
Telerik team
answered on 22 Jun 2011, 09:10 AM
Hello Oliver,

I guess you are using multiple selection and when you start dragging items are being selected. Correct me if I am wrong. To fix this you can set DragElementAction to None.


Greetings,
Milan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Oliver
Top achievements
Rank 1
answered on 22 Jun 2011, 09:46 AM
Take a look at this picture: http://www.flickr.com/photos/47457340@N06/5859628606/in/photostream/

The list on the left selects the currently selected document and thus load its content into the editor on the right. If I want to start a drag operation on a list node to (in order to create a link to it in the currently open document), the selection is changed and thus the current document. Which makes it impossible to implement this feature. In order to prevent this I would have to be able to cancel the selection change when a drag operation start is detected. Please note that rolling-back a selection change is not feasible. That's why I've opted to initiate the drag operation with the right button to bypass the selection change problem.

0
Milan
Telerik team
answered on 22 Jun 2011, 10:09 AM
Hi Oliver,

Unfortunately it is not possible to perform dragging with the right mouse button. 

One thing that comes to my mind is to try to handle selection yourself. First you should disable automatic selection by setting CanUserselect to false. Then handle the MouseUp event like this:

public MainPage()
{
    InitializeComponent();
  
    this.clubsGrid.CanUserSelect = false;
    this.AddHandler(FrameworkElement.MouseLeftButtonUpEvent, new MouseButtonEventHandler(OnMouseUp), true);
}
  
private void OnMouseUp(object sender, MouseButtonEventArgs e)
{
    Debug.WriteLine("UP");
  
    var element = e.OriginalSource as FrameworkElement;
    var row = element.ParentOfType<GridViewRow>();
  
    if (row != null)
    {
        row.IsSelected = true;
    }
}


Kind regards,
Milan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Oliver
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Oliver
Top achievements
Rank 1
Milan
Telerik team
Share this question
or