MicrosoftEdge / MicrosoftEdge/WebView2Feedback
Dragging from WebView2 to any WPF control doesn't work if a WPF Popup is opened
@bradp0721 is already working on this.
Since Aug 30, 2023.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
Description
Dragging from WebView2 to any WPF control doesn't work if a WPF Popup is opened
Version
SDK: 1.0.1222-prerelease
Runtime: Evergreen, 104.0.1293.54
Framework: WPF
OS: Win11 21H2 (OS Build 22000, 856)
Repro Steps
- Create a sample app with a menu and add the code from additional context to open the popup on DragOver.
- Start dragging any element from WebView2 (text, image link, etc.)
- Drag that element over the menu to make the submenu open
- Drop the element
Expected:
- Element is dropped and Drop event arrives in menu
Actual:
- Drag operation is stuck and the popup stays open until the drag operation is cancelled by pressing Escape.
- If another drag operation is called using
DragDrop.DoDragDropthenCOMExceptionwithA drag operation is already in progressmessage.
Screenshots

Additional context
The same steps work fine when dragging things from Edge / Chrome which makes me think this is a WebView2 bug, not a WPF bug.
The following code was used with WebView2WpfBrowser in WebView2Samples project:
private void Menu_DragOver(object sender, DragEventArgs e)
{
e.Effects = e.AllowedEffects;
e.Handled = true;
if (sender is UIElement uiElement)
{
var position = e.GetPosition(uiElement);
var result = VisualTreeHelper.HitTest(uiElement, position);
var menuItem = FindVisualParent<MenuItem>(result?.VisualHit);
if (menuItem?.HasItems == true)
{
menuItem.IsSubmenuOpen = true;
}
}
}
private void Menu_Drop(object sender, DragEventArgs e)
{
e.Handled = true;
MessageBox.Show(this, $"'{e.Data.GetData(DataFormats.UnicodeText)}' dropped");
}
public static T FindVisualParent<T>(DependencyObject element)
where T : DependencyObject =>
element == null ? null : element as T ?? FindVisualParent<T>(VisualTreeHelper.GetParent(element));
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.