Пример #1
0
        private void Webview_CreateWindow(object sender, CreateWindowEventArgs e)
        {
            if (PopupHandlingDisabled)
            {
                return;
            }

            TabControl tabs = this.FindTabControl();

            if (tabs == null)
            {
                e.Cancel = true;
                return;
            }

            var avaloniaWindow = this.GetVisualRoot() as Window;

            if (avaloniaWindow == null)
            {
                throw new InvalidOperationException("Window not found!");
            }

            var webview = new CustomWebView((WebView)this.WebView);

            IPlatformHandle platformHandle = avaloniaWindow.PlatformImpl.Handle;

            if (platformHandle is IMacOSTopLevelPlatformHandle macOSHandle)
            {
                e.WindowInfo.SetAsWindowless(macOSHandle.GetNSWindowRetained());
            }
            else
            {
                e.WindowInfo.SetAsWindowless(platformHandle.Handle);
            }

            e.Client = webview.Client;
            OnCreateWindow(webview);
        }
Пример #2
0
 public CustomWebViewGlue(CustomWebView view)
     : base(view)
 {
 }