none
DataRepeater Control RRS feed

  • Question

  • Guys,

    I am trying to drag and drop items in my data repeater control (VS2010), For some reason mouse events are not raised in the ItemTemplate section of the repeater.

    Can someone show me how to drag and drop (changing items order) in DataRepeater control?

    I have a textbox and a label in my ItemTemplate section.

    Thanks

    • Moved by Youen Zen Wednesday, April 10, 2013 7:21 AM From Visual Basic
    Tuesday, April 9, 2013 4:07 PM

Answers

All replies

  • Read this announcement message of this forum and then the part around Windows Forms controls.

    http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/threads?announcementId=b5956386-b706-4180-b003-6e778f582d89#b5956386-b706-4180-b003-6e778f582d89


    Success
    Cor

    Wednesday, April 10, 2013 7:01 AM
  • Mainly drag and drop is always done using the clipboard that is for all windows forms controls the same.

    Can you tell us why the methods on this page fail for you?

     http://msdn.microsoft.com/en-us/library/5a37ax35(v=VS.90).aspx


    Success
    Cor

    Wednesday, April 10, 2013 7:31 AM
  • Mainly drag and drop is always done using the clipboard that is for all windows forms controls the same.

    Can you tell us why the methods on this page fail for you?

     http://msdn.microsoft.com/en-us/library/5a37ax35(v=VS.90).aspx


    Success
    Cor

    The reason i can't get it to work is because of the following link which talk about the limitation of DataRepeater control:

    http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/485617d0-fef3-4ad2-aa32-ad98d7515cc0/

    From the link above, they suggest that I put a panel control in the ItemTemplate section of the repeater and adding my other controls back on it in order to handle any mouse events but still not working, that's why I wanted to see if anyone out there has been able to drag items around from specifically a DataRepeater control or not? I am just afraid it's not possible with this control and I am trying to beat a dead hourse.

    here is my code so far with the panel control inserted in the itemtemplate section of the repeater as the above link suggested:

    Private Sub Panel1_DragDrop(sender As Object, e As System.Windows.Forms.DragEventArgs) Handles Panel1.DragDrop
            DataRepeater1.CurrentItemIndex = e.Data.GetData(DataFormats.Text)
        End Sub
    
        Private Sub Panel1_DragEnter(sender As Object, e As System.Windows.Forms.DragEventArgs) Handles Panel1.DragEnter
            If (e.Data.GetDataPresent(DataFormats.Text)) Then
                e.Effect = DragDropEffects.Move
            Else
                e.Effect = DragDropEffects.None
            End If
        End Sub
    
        Private Sub Panel1_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseDown
            DataRepeater1.DoDragDrop(DataRepeater1.CurrentItemIndex, DragDropEffects.Move)
        End Sub

    If could see what am I doing wrong, basically I see the item is being dragged on my mouse down event but I don't think the DataRepeater is allowing me to drop it anywhere althought i specified AllowDrop = True on all controls!


    • Edited by sync_master Wednesday, April 10, 2013 12:05 PM
    Wednesday, April 10, 2013 12:05 PM

  • The reason i can't get it to work is because of the following link which talk about the limitation of DataRepeater control:

    http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/485617d0-fef3-4ad2-aa32-ad98d7515cc0/

    From the link above, they suggest that I put a panel control in the ItemTemplate section of the repeater and adding my other controls 


    Hi sync_master,

    The link posted is same to current thread. I think you probably posted a wrong link. Could you please double check this?

    Best Regards, 


    Bob Wu
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, April 12, 2013 6:58 AM
    Moderator
  • I have given on the data repeater due to lack of examples and documentation, I will try I can use RichTextBoxes within a DataGridView

    Thanks

    Friday, April 12, 2013 11:39 AM
  • Hi Sync,

    >>I will try I can use RichTextBoxes within a DataGridView

    Do you have any updates?

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Sunday, May 5, 2013 5:42 AM
    Moderator
  • It can be done but very complicated and require you to extend the default datagrid class.
    • Marked as answer by sync_master Monday, May 6, 2013 3:04 PM
    Monday, May 6, 2013 3:04 PM