Skip to content

Commit

Permalink
Only move the playlist item if the operation is actually a playlist i…
Browse files Browse the repository at this point in the history
…tem move operation
  • Loading branch information
flagbug committed Jun 18, 2014
1 parent 32e1d44 commit 47c447b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Espera/Espera.View/Views/ShellView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -352,11 +352,14 @@ private void WireDragAndDrop()
.Subscribe();

// Moving items inside the playlist
const string movePlaylistSongFormat = "MovePlaylistSong";

this.PlaylistListBox.ItemContainerStyle.RegisterEventSetter<MouseEventArgs>(MouseMoveEvent, x => new MouseEventHandler(x))
.Where(x => x.Item2.LeftButton == MouseButtonState.Pressed && this.shellViewModel.SelectedPlaylistEntries.Any())
.Subscribe(x => DragDrop.DoDragDrop((ListBoxItem)x.Item1, this.shellViewModel.SelectedPlaylistEntries.First(), DragDropEffects.Move));
.Subscribe(x => DragDrop.DoDragDrop((ListBoxItem)x.Item1, movePlaylistSongFormat, DragDropEffects.Move));

this.PlaylistListBox.ItemContainerStyle.RegisterEventSetter<DragEventArgs>(DropEvent, x => new DragEventHandler(x))
.Where(x => x.Item2.Data.GetDataPresent(DataFormats.StringFormat) && (string)x.Item2.Data.GetData(DataFormats.StringFormat) == movePlaylistSongFormat)
.Subscribe(x =>
{
if (this.shellViewModel.MovePlaylistSongCommand.CanExecute(null))
Expand Down

0 comments on commit 47c447b

Please sign in to comment.