Wondering How Drag and Drop control is useful in my situation

5 posts, 0 answers
  1. ankit
    ankit avatar
    29 posts
    Member since:
    Sep 2008

    Posted 22 Oct 2008 Link to this post

    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.

  2. ankit
    ankit avatar
    29 posts
    Member since:
    Sep 2008

    Posted 22 Oct 2008 Link to this post

    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.





  3. DevCraft banner
  4. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 28 Oct 2008 Link to this post

    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.
  5. ankit
    ankit avatar
    29 posts
    Member since:
    Sep 2008

    Posted 28 Jan 2009 Link to this post

    How do I use DragGroup in DraggableListBox ?
  6. ankit
    ankit avatar
    29 posts
    Member since:
    Sep 2008

    Posted 28 Jan 2009 Link to this post

    Ohhhhh...

    I realize what to do. thanks anyway
Back to Top
DevCraft banner