diff --git a/Studio/CelesteStudio/Studio.cs b/Studio/CelesteStudio/Studio.cs index d443ccc6..9a2e6f72 100644 --- a/Studio/CelesteStudio/Studio.cs +++ b/Studio/CelesteStudio/Studio.cs @@ -84,7 +84,6 @@ public Studio(string[] args, Action windowCreationCallback) { Instance = this; Icon = Assets.AppIcon; MinimumSize = new Size(250, 250); - AllowDrop = true; WindowCreationCallback = windowCreationCallback; @@ -180,6 +179,17 @@ public Studio(string[] args, Action windowCreationCallback) { Editor = new Editor(Document.Dummy, editorScrollable); editorScrollable.Content = Editor; + // WPF requires a control for drag n' drop support + Editor.AllowDrop = true; + Editor.DragDrop += (_, e) => { + if (e.Data.ContainsUris && e.Data.Uris.Length > 0) { + OpenFile(Uri.UnescapeDataString(e.Data.Uris[0].AbsolutePath)); + } + }; + Editor.DragEnter += (_, e) => { + e.Effects = DragEffects.Copy; + }; + // On GTK, prevent the scrollable from reacting to Home/End if (Eto.Platform.Instance.IsGtk) { editorScrollable.KeyDown += (_, e) => e.Handled = true; @@ -352,15 +362,6 @@ private void ApplySettings() { Menu = CreateMenu(); // Recreate menu to reflect changes } - protected override void OnDragDrop(DragEventArgs e) { - if (e.Data.ContainsUris && e.Data.Uris.Length > 0) { - OpenFile(Uri.UnescapeDataString(e.Data.Uris[0].AbsolutePath)); - } - } - protected override void OnDragEnter(DragEventArgs e) { - e.Effects = DragEffects.Copy; - } - protected override void OnClosing(CancelEventArgs e) { if (!ShouldDiscardChanges(checkTempFile: false)) { e.Cancel = true;