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

Wondering How Drag and Drop control is useful in my situation

4 Answers 101 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
ankit
Top achievements
Rank 1
ankit asked on 23 Oct 2008, 12:38 AM
I am using this control in my application and works fine.
But, in the next stage I need to develop something like this.

I will be having 4 Drag Drop Box like following.

Parent Box : A
Child Box : AA

Parent Box : B
Child Box : BB

I should be able to Drag from BB to AA & AA to BB.
I should be able to Drag from A to B & B to A.
But, if Someone try to drag something from A  to AA or B to BB or BB to B or AA to A, I should not allow. Is there any property which I can use for this.

Technically :
ObservableCollection of BB and AA is same.
ObservableCollection of A and B is different to AA and BB.
ObservableCollection of A and B are different, but I can make same if it's required.

It will be great if you can provide me some example briefly as I don't need to know Hello World type of knowledge, However, this control has little documentation, so, Example or proper reply will be great.

Thanks.

4 Answers, 1 is accepted

Sort by
0
ankit
Top achievements
Rank 1
answered on 23 Oct 2008, 04:47 AM
Also, I found one problem in this control. I am not sure where this is a problem or I haven't found it's solution yet.

In Drag Drop box, I am loading few images. Path comes from database and Images are coming form path. It is possible in my case that path is not corrent or  image is not there by some reason. So, Image Tag will give error. That's fine. I put  following code.

<Image Source="{Binding DocIcon, Converter={StaticResource DocImagePath}}"
                                           Margin="0 0 3 0" ImageFailed="Image_ImageFailed"
                                           HorizontalAlignment="Center" />

Means in case of Error it will go to Image_ImageFailed function.
Fine. I am loading one static image in that function.

But, When I Drag and Drop through my mouse, it will again give error because image comes from Template Specified in DraggableListBox class ( Red Telerik Class ). I put same functionality there in template. Means I put ImageFailed="Image_ImageFailed" in template.

But, Now problem is at the time of error it doesn't go to this function. Even, I put Binding validation Error in Template, still doesn't go there. I put break point in VS 2008.

Too much.. If anyone has solution for this, let me know. Also, telerik people, if this is a problem, confirm. So, I can move on and wait for your next release with fix.

Thanks.





0
Miroslav
Telerik team
answered on 28 Oct 2008, 12:50 PM
Hello ankit,

Sorry for not replying earlier.

For your first question:

Yes, the distinction between child and parent DragDrop destination controls can be made. I implemented a proof-of-concept drag drop for your case. The identification of the controls is through a property that I added: DragGroup. Of course, you may implement whatever logic you need in your handlers that will recognize whether two controls can exchange items. The items do not need to be of one and the same kind (neither the collections) - just in the DropInfo handler, make sure they are converted/transformed accordingly.

A thing to remember is that if not handled a routed event will appear both at the child and the parent containers. This is true both for query and info events.

I have attached the sample.

For your second question:

In the example for  the DraggableListBox we have used a ContentTemplate, but the DragCue can be anything - including something like a UserControl which will contain the logic for the error handling (the image will be bound to a property of the UserControl and you will have the instance of the Image. Otherwise ContentTemplates do not support signing up for events.

Greetings,
Miroslav
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
ankit
Top achievements
Rank 1
answered on 29 Jan 2009, 02:57 AM
How do I use DragGroup in DraggableListBox ?
0
ankit
Top achievements
Rank 1
answered on 29 Jan 2009, 03:30 AM
Ohhhhh...

I realize what to do. thanks anyway
Tags
DragAndDrop
Asked by
ankit
Top achievements
Rank 1
Answers by
ankit
Top achievements
Rank 1
Miroslav
Telerik team
Share this question
or