none
listBox.SelectedItem problem

    Question

  • Im using D&D from list box to textBox and the problem is that the you can just click on item(the item marked with blue color) let say the first item in the list and than you can go to the list and with the mouse drag different item let say the last item in the list but the item that was actually dragged is the item which you selected via click which is marked with blue color...      i.e. the first item.

    while debug I Saw that the item which you get in the following code is first item which you click and mark as blue and not the item that you actually dragged,any idea how to solve it?

    you can click and mark any item on the listBox but drag different item while the previous item is marked with blue color...

    var listBox = sender as ListBox;
    
                        if (listBox.SelectedItem != null)
                        {
                            var mySelectedItem = listBox.SelectedItem as User;

    Sunday, January 26, 2014 7:45 PM

Answers

  • In the code that handles the drag / drop you will have to make the item which the mouse is over the selected item.  Seems like a problem but it is the same in WinForms.

    Lloyd Sheen

    • Marked as answer by Miley H Monday, January 27, 2014 8:43 AM
    Sunday, January 26, 2014 11:02 PM