WPF 命名空间 'System.Windows' 中不存在类型或命名空间名称 'Browser'(是否缺少程序集引用?)
WPF The type or namespace name 'Browser' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?)
我目前正在将我的应用程序从 Silverlight 更改为 WPF。我有这段代码在 wpf 中给我一个错误。
我得到的错误是:
Error 1 The type or namespace name 'Browser' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?) C:\Users\sahluwai\Desktop\cusControls2\leitch\HarrisSilverlightToolkit\Toolkit\Source\Core\BaseComponents\HelpManager.cs 148 52 BaseComponents
private void OpenHelpFileForThisControl(Control passedControl)
{
if (passedControl != null)
{
//////////////////This line gives an error as System.windows.Brower is not present in wpf
string uriCurrent = System.Windows.Browser.HtmlPage.Document.DocumentUri.OriginalString;
if ((uriCurrent.LastIndexOf('/') + 1) < uriCurrent.Length)
{
uriCurrent = uriCurrent.Remove(uriCurrent.LastIndexOf('/') + 1);
}
System.Windows.Browser.HtmlPage.Window.Navigate(new Uri(uriCurrent + HTMLPrefix + ((string)passedControl.Tag)), "_blank");
}
}
所以现在的问题是我现在应该用什么替换它以便它在 wpf 中工作
在 WPF 中,您应该使用 System.Windows.Controls.WebBrowser 而不是浏览器
我目前正在将我的应用程序从 Silverlight 更改为 WPF。我有这段代码在 wpf 中给我一个错误。
我得到的错误是:
Error 1 The type or namespace name 'Browser' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?) C:\Users\sahluwai\Desktop\cusControls2\leitch\HarrisSilverlightToolkit\Toolkit\Source\Core\BaseComponents\HelpManager.cs 148 52 BaseComponents
private void OpenHelpFileForThisControl(Control passedControl)
{
if (passedControl != null)
{
//////////////////This line gives an error as System.windows.Brower is not present in wpf
string uriCurrent = System.Windows.Browser.HtmlPage.Document.DocumentUri.OriginalString;
if ((uriCurrent.LastIndexOf('/') + 1) < uriCurrent.Length)
{
uriCurrent = uriCurrent.Remove(uriCurrent.LastIndexOf('/') + 1);
}
System.Windows.Browser.HtmlPage.Window.Navigate(new Uri(uriCurrent + HTMLPrefix + ((string)passedControl.Tag)), "_blank");
}
}
所以现在的问题是我现在应该用什么替换它以便它在 wpf 中工作
在 WPF 中,您应该使用 System.Windows.Controls.WebBrowser 而不是浏览器