public void HandleDragLeave(object sender, DragEventArgs e) { DbComparisonViewModel viewModel = (DbComparisonViewModel)this.DataContext; if (!e.Data.GetDataPresent(AppValues.ProfileDataFormat) || !viewModel.CanDoClearProfilesCommand(this)) { e.Effects = DragDropEffects.None; e.Handled = true; } }
public void HandleDrop(object sender, DragEventArgs e) { DbComparisonViewModel viewModel = (DbComparisonViewModel)this.DataContext; if (e.Data.GetDataPresent(AppValues.ProfileDataFormat) && viewModel.CanDoClearProfilesCommand(this)) { Border dropTarget = ViewHelpers.FindAncestor <Border>((DependencyObject)e.OriginalSource); Profile profile = (Profile)e.Data.GetData(AppValues.ProfileDataFormat); if (dropTarget.Name == DbComparisonViewModel.LeftDropTargetElementName) { viewModel.LeftProfile = profile; } else if (dropTarget.Name == DbComparisonViewModel.RightDropTargetElementName) { viewModel.RightProfile = profile; } } }