Description
What happened?
In the latest version of Microsoft.Web.WebView2, version "1.0.3065.39", the WebView2CompositionControl does not allow Drag and Drop into the WebView2 component.
It does work for WebView2, but not for WebView2CompositionControl. We need to use WebView2CompositionControl to allow the web views to draw underneath other WPF components.
Importance
Moderate. My app's user experience is affected, but still usable.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
1.0.3065.39
SDK Version
net472
Framework
WPF
Operating System
Windows 10
OS Version
19045.5487
Repro steps
I created a little app to test the functionality.
MainWindow.xaml
<Window x:Class="AllowExternalDropTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:AllowExternalDropTest"
xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<DockPanel>
<wv2:WebView2CompositionControl Name="webView" Source="https://www.google.com" AllowExternalDrop="True" />
</DockPanel>
</Grid>
</Window>
AllowExternalDropTest.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net472</TargetFramework>
<UseWPF>true</UseWPF>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<Optimize>False</Optimize>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3065.39" />
</ItemGroup>
MainWindow.xaml.cs
using Microsoft.Web.WebView2.Core;
using System;
using System.Windows;
namespace AllowExternalDropTest
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}
The app will open Google.
Click on "Search by Image"
Attempt to drag an image into the WebView.
Observe:
Dragging an image is not allowed for upload.
This functionality works fine if using WebView2. However, we need to use WebView2CompositionControl, as we require the webview to draw underneath other WPF elements as per this bug.
Test Source Code:
Repros in Edge Browser
No, issue does not reproduce in the corresponding Edge version
Regression
No, this never worked
Last working version (if regression)
No response
Activity