Click here to Skip to main content
15,943,008 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear all,

I am trying to drag list view items and I could do it, but when I try to drag the scroll bar, I could not do it as dragdrop was done in mousemove event.

Here is my code,

C#
private void listView_Testcase_PreviewMouseMove(object sender, MouseEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                sourcelistview = (ListView)sender;

                foreach (object selItem in _selItems)
                {
                    if (!sourcelistview.SelectedItems.Contains(selItem))
                        sourcelistview.SelectedItems.Add(selItem);

                }
                if (sourcelistview.SelectedItems.ToString() != null)
                {
                    DragDrop.DoDragDrop(sourcelistview, sourcelistview.SelectedItems.ToString(), DragDropEffects.Copy);
                }

                else { return; }
            }
        }
Posted

1 solution

Hi all...

Found the answer...

Placing the grid inside Scrollviewer solves this problem

<ScrollViewer>

<Grid>
....
</Grid>

</ScrollViewer>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900