protected virtual void DragSourceInitialized(object sender, TreeViewExtensions.DragSourceInitializedEventArgs e) { var viewModel = this.FindResource <global::FoxTunes.ViewModel.LibraryTree>("ViewModel"); if (viewModel != null && viewModel.ShowCursorAdorners) { this.MouseCursorAdorner.DataContext = viewModel.SelectedItem; this.MouseCursorAdorner.Show(); } try { DragDrop.DoDragDrop( this, e.Data, DragDropEffects.Copy ); } finally { if (this.MouseCursorAdorner.IsVisible) { this.MouseCursorAdorner.Hide(); } } }
protected virtual void DragSourceInitialized(object sender, TreeViewExtensions.DragSourceInitializedEventArgs e) { var viewModel = this.FindResource <global::FoxTunes.ViewModel.LibraryTree>("ViewModel"); if (viewModel != null) { if (LibraryHierarchyNode.Empty.Equals(viewModel.SelectedItem)) { return; } //Only show adorners when hosted in main window. if (this.IsHostedIn <MainWindow>() && viewModel.ShowCursorAdorners) { this.MouseCursorAdorner.Show(); } } try { DragDrop.DoDragDrop( this, e.Data, DragDropEffects.Copy ); } finally { if (this.MouseCursorAdorner.IsVisible) { this.MouseCursorAdorner.Hide(); } } }