@dovid
פרוייקט נקי עובד.
מסתבר שהבעיה דוקא כשאני עושה בvsto
מצו"ב המידע שביקשת


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Word = Microsoft.Office.Interop.Word;
using Office = Microsoft.Office.Core;
using Microsoft.Office.Tools.Word;
using System.Windows;
using System.Windows.Forms;
namespace TestVstoWebView
{
public partial class ThisAddIn
{
private Microsoft.Office.Tools.CustomTaskPane taskPane;
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
UserControl hostControl = new UserControl();
hostControl.Load += HostControl_Load;
taskPane = this.CustomTaskPanes.Add(hostControl, "תורת אמת");
taskPane.Visible = true;
taskPane.Width = 450;
}
private void HostControl_Load(object sender, EventArgs e)
{
Window window = new Window();
webviewcontrol webviewcontrol = new webviewcontrol();
window.Content = webviewcontrol;
window.Show();
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}
#region VSTO generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
}
#endregion
}
}
<UserControl x:Class="TestVstoWebView.webviewcontrol"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:TestVstoWebView"
xmlns:webview ="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<webview:WebView2 x:Name="webView"/>
</Grid>
</UserControl>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace TestVstoWebView
{
/// <summary>
/// Interaction logic for webviewcontrol.xaml
/// </summary>
public partial class webviewcontrol : UserControl
{
public webviewcontrol()
{
InitializeComponent();
InitializeWebview();
}
async void InitializeWebview()
{
await webView.EnsureCoreWebView2Async();
webView.NavigateToString("test string");
}
}
}
יצויין שכנ"ל אותו הקוד בדיוק עובד בפרוייקט רגיל הבעיה מתחילה רק בvsto