Closed gaetandezeiraud closed 2 years ago
@Brouilles sorry, I have not really had bandwidth to revisit some of the flow here. When you say it no longer work as expected, you mean the context menu is not expected to show?
Does it seem related to this? https://stackoverflow.com/questions/63322779/wpf-webview2-not-able-to-disable-context-menu?
I will find sometime over the weekend to reproduce.
@Brouilles
I made a change in SampleConfig.cs and works for me:
internal class SampleConfig : Configuration
{
public SampleConfig() : base()
{
// ------
WebView2CreationOptions.AreDefaultContextMenusEnabled = false;
}
}
It is during the initialization of the webview, before the html render. I can open the context menu. During some ms/s.
I am not quite sure what you are trying to do really. But my guess is it may be a threading issue. Some functions will not work if not executed on the browser thread.
Please can you see how the dispatcher is used here:
More samples here - https://github.com/webview2/EdgeSharp/search?q=Dispatcher.Browser
If that does not work, you may need to attach a skeletal sample.
I have set
WebView2CreationOptions.AreDefaultContextMenusEnabled = false;
inSampleEdgeSharpConfig.cs
to disable the right click. I am based on the Win32 sample. The problem is between the window creation and the render of the webview. During this interval the right click (so the context menu) can be trigger. But when the page is loaded and displayed by the web view, the context menu no longer works as expected.