CommunityToolkit / Microsoft.Toolkit.Win32

ARCHIVE - This repository contained XAML Islands wrapper controls and tooling for XAML Islands with WinUI 2, see readme for more info about XAML Islands with WinUI 3 and the WindowsAppSDK.
https://aka.ms/windowsappsdk
Other
383 stars 89 forks source link

[Question] Should the mouse events work on WebView in WPF? #297

Closed atiyka closed 3 years ago

atiyka commented 3 years ago

I have a WPF (.netcore3.1) application and I'm using the WebView via the package Microsoft.Toolkit.Wpf.UI.Controls.WebView (6.1.2). It displays the html correctly, but I'm not able to catch the mouse events. I tried multiple mouse events, like MouseWheel, PreviewMouseWheel, MouseLeftButtonDown and so on, but none of them is fired when it should be. I attached the event listener after the html is content loaded with the following code: browserView.MouseWheel += Browser_MouseWheel;

Is this a bug? Or I missed some information?

ghost commented 3 years ago

Hello atiyka, thank you for your interest in Win32!

I have automatically added a "needs triage" label to help get things started. Our team will look into the question and answer ASAP. Other community members may also answer the question and provide feedback 🙌

ghost commented 3 years ago

This issue has been marked as "needs attention 👋" due to no activity for 15 days. Please triage the issue so the fix can be established.

ghost commented 3 years ago

This issue has been marked as "needs attention 👋" due to no activity for 15 days. Please triage the issue so the fix can be established.

ghost commented 3 years ago

This issue has been marked as "needs attention 👋" due to no activity for 15 days. Please triage the issue so the fix can be established.

michael-hawker commented 3 years ago

@atiyka I don't think any of the standard events are automatically hooked up for you. You'd have to inject JavaScript to listen to the events from the page?

@pagoe-msft can correct me if I'm wrong, but it's best to test this out on WebView2 and file an issue on their repo if it doesn't work as expected.

atiyka commented 3 years ago

Thanks for the answer, finally I solved it by using JavaScript. I also tried the WebView2, but it has lots of bugs and it's almost unusable, so I went back to the previous version. Most of the bugs are already reported in github, but until it'll be fixed, I will use this version.