B
Bogdan-Sorin
Guest
Hi,
I have a listview with a bunch of files that are being loaded when application loads.
I had to implement drag and drop for a file in another listbox when right click mouse is holded and moved across that listbox.
Problem that I have with my implementation is that when I try to change selection in listview I have to double click it. Works on single click too but I have to wait a bit after previous item was selected.
Here is the code.
//Preview mouse down event handler.
private void LstViewFiles__PreviewMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
// Disable dragging on right click button.
if (e.RightButton == System.Windows.Input.MouseButtonState.Pressed)
return;
System.Windows.Controls.ListView parent = sender as System.Windows.Controls.ListView;
object data = lstViewFiles_.SelectedItem as FileDetails;
if (data != null)
{
//TODO try to fix delay on switching items from files listbox.
DragDrop.DoDragDrop(parent, data, System.Windows.DragDropEffects.Move);
}
}
Thanks in advance.
Continue reading...
I have a listview with a bunch of files that are being loaded when application loads.
I had to implement drag and drop for a file in another listbox when right click mouse is holded and moved across that listbox.
Problem that I have with my implementation is that when I try to change selection in listview I have to double click it. Works on single click too but I have to wait a bit after previous item was selected.
Here is the code.
//Preview mouse down event handler.
private void LstViewFiles__PreviewMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
// Disable dragging on right click button.
if (e.RightButton == System.Windows.Input.MouseButtonState.Pressed)
return;
System.Windows.Controls.ListView parent = sender as System.Windows.Controls.ListView;
object data = lstViewFiles_.SelectedItem as FileDetails;
if (data != null)
{
//TODO try to fix delay on switching items from files listbox.
DragDrop.DoDragDrop(parent, data, System.Windows.DragDropEffects.Move);
}
}
Thanks in advance.
Continue reading...