I have a Listbox a MainControl and 4 PreviewControls. I would like when i click an item from the listbox that the mainControl changes (This happens). But i would like to add a dragg behavior to the listboxitems so i can drag a listboxitem to one of the previewControls. I tried this but when i try to drag the listboxitem the selectionchanged event is always fired.
So i would like that when i do MouseLeftDown and move the listboxitem, Do drag. And When Click or MouseLefUp (selectionchanged) occurs the MainControl changes.
I tried this but PreviewMouseLeftButtonDown event again the other events aren't executed.
private void lstCameras_PreviewMouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)
{
startPoint = e.GetPosition(null);
if (!Test) e.Handled = true;
else
{
Test = false;
}
Console.WriteLine("lstCameras_PreviewMouseLeftButtonDown_1 Handled = " + e.Handled);
}
private void lstCameras_PreviewMouseUp_1(object sender, MouseButtonEventArgs e)
{
Console.WriteLine("lstCameras_MouseUp_1");
if (!Test)
{
Test = true;
lstCameras.RaiseEvent(new MouseButtonEventArgs(Mouse.PrimaryDevice, Environment.TickCount, MouseButton.Left) { RoutedEvent = ListBox.PreviewMouseLeftButtonDownEvent });
}
else
{
Test = false;
}
Console.WriteLine("end lstCameras_MouseUp_1 Test = " + Test);
}