Hi,
Is it possible to get drag and drop working with the RadWrapPanel? If so do could you upload a sample of how to get this working?
I am populating a wrappanel with images and would like to be able to drag those images from the wrappanel onto another control and also drag from the other control onto the images in the wrappanel.
Thanks,
Joe
Is it possible to get drag and drop working with the RadWrapPanel? If so do could you upload a sample of how to get this working?
I am populating a wrappanel with images and would like to be able to drag those images from the wrappanel onto another control and also drag from the other control onto the images in the wrappanel.
Thanks,
Joe
4 Answers, 1 is accepted
0

Joe
Top achievements
Rank 1
answered on 20 Mar 2009, 01:02 AM
I was able to get the dragging working on my controls that are inside the wrappanel. However I had to remove the mouseenter, mouseleave, and mouseleftclick event. I need these events to handle selecting / multi selecting of the items in my wrappanel. Is it possible to have drag and drop work on a custom control that handles these events? Are there any workarounds to get this to work?
Thanks,
Joe
Thanks,
Joe
0
Hi Joe,
Sorry for the delayed reply!
I prepared a sample solution where drag/drop to a wrap panel is implemented (attached). I do have not handle the case where you drop directly to the panel, but that should be easy enough to implement.
As for the second question: If you handle the mouse events and there is no other object that the DragDrop can listen to (normally a visual descendant, overlaying the control that handles the events) then there is no workaround for it to work. I.e. if you handle the mouse events of a panel or a rectangle and the panel is empty, the drag drop will not work.
If you are trying to handle the events of a panel, you can try putting it in an items control (or any other wrapper really and handling the events of the wrapper). The DragDrop uses some tricks to listen to events of children objects (which are normally not handled) but there is no way that it could know about handled events.
Did the DragDrop work in your specific case? If you provide more info on the particular problem, I may come up with some ideas.
Greetings,
Miroslav
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Sorry for the delayed reply!
I prepared a sample solution where drag/drop to a wrap panel is implemented (attached). I do have not handle the case where you drop directly to the panel, but that should be easy enough to implement.
As for the second question: If you handle the mouse events and there is no other object that the DragDrop can listen to (normally a visual descendant, overlaying the control that handles the events) then there is no workaround for it to work. I.e. if you handle the mouse events of a panel or a rectangle and the panel is empty, the drag drop will not work.
If you are trying to handle the events of a panel, you can try putting it in an items control (or any other wrapper really and handling the events of the wrapper). The DragDrop uses some tricks to listen to events of children objects (which are normally not handled) but there is no way that it could know about handled events.
Did the DragDrop work in your specific case? If you provide more info on the particular problem, I may come up with some ideas.
Greetings,
Miroslav
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0

Robert Staniskis
Top achievements
Rank 1
answered on 07 Jul 2010, 05:25 PM
Hello,
I downloaded the sample you posted in this thread and it works well. Would you be able to modify it so that it supports drop cues?
Thanks so much,
Robert
I downloaded the sample you posted in this thread and it works well. Would you be able to modify it so that it supports drop cues?
Thanks so much,
Robert
0
Hello Robert Staniskis,
You can add a DataTemplate for the DragCue in the Resources of the main page, like so:
Then in the OnDragQuery() event handler you can add this DataTemplate as a ContentTemplate for the DragCue, like so:
I modified the example accordingly. Please take a look at it and let me know if this is what you had in mind.
Sincerely yours,
Tina Stancheva
the Telerik team
You can add a DataTemplate for the DragCue in the Resources of the main page, like so:
<!-- DragCue Template-->
<
DataTemplate
x:Key
=
"DragCueTemplate"
>
<
TextBlock
Text
=
"{Binding Name}"
/>
</
DataTemplate
>
Then in the OnDragQuery() event handler you can add this DataTemplate as a ContentTemplate for the DragCue, like so:
private
void
OnDragQuery(
object
sender, DragDropQueryEventArgs e)
{
if
(e.Options.Status == DragStatus.DragQuery)
{
...
var dragCue = RadDragAndDropManager.GenerateVisualCue(sourceControl);
dragCue.HorizontalAlignment = HorizontalAlignment.Left;
dragCue.Content = sourceControl.DataContext;
dragCue.ContentTemplate =
this
.Resources[
"DragCueTemplate"
]
as
DataTemplate;
e.Options.DragCue = dragCue;
e.Options.Payload =
new
DragDropOperation() { Payload = sourceControl.DataContext };
}
...
}
I modified the example accordingly. Please take a look at it and let me know if this is what you had in mind.
Sincerely yours,
Tina Stancheva
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