예제 #1
0
        private void ListBox_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            ListBox parent = sender as ListBox;

            BandStrapp data = GetObjectDataFromPoint(parent, e.GetPosition(parent)) as BandStrapp;

            if (data != null)
            {
                DragDrop.DoDragDrop(parent, data, DragDropEffects.Move);
            }
        }
예제 #2
0
        // Drag & Drop care of http://stackoverflow.com/a/4004590
        private void ListBox_Drop(object sender, DragEventArgs e)
        {
            ListBox    parent = sender as ListBox;
            BandStrapp data   = e.Data.GetData(typeof(BandStrapp)) as BandStrapp;
            BandStrapp objectToPlaceBefore = GetObjectDataFromPoint(parent, e.GetPosition(parent)) as BandStrapp;

            if (data != null && objectToPlaceBefore != null)
            {
                int index = _band.Tiles.Strip.IndexOf(objectToPlaceBefore);

                _band.Tiles.Strip.Remove(data);
                _band.Tiles.Strip.Insert(index, data);
                parent.SelectedItem = data;
            }
        }