BrowserInteropHelper.IsBrowserHosted Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a value that specifies whether the current Windows Presentation Foundation (WPF) application is browser hosted.
public:
static property bool IsBrowserHosted { bool get(); };
public static bool IsBrowserHosted { get; }
static member IsBrowserHosted : bool
Public Shared ReadOnly Property IsBrowserHosted As Boolean
true
if the application is browser hosted; otherwise, false
.
The following example demonstrates how to use BrowserInteropHelper.IsBrowserHosted to determine if a Page is hosted in a browser.
// Detect if browser hosted
if (BrowserInteropHelper.IsBrowserHosted)
{
// Note: can only inspect BrowserInteropHelper.Source property if page is browser-hosted.
this.dataTextBlock.Text = "Is Browser Hosted: " + BrowserInteropHelper.Source.ToString();
}
else
{
this.dataTextBlock.Text = "Is not browser hosted";
}
' Detect if browser hosted
If BrowserInteropHelper.IsBrowserHosted Then
' Note: can only inspect BrowserInteropHelper.Source property if page is browser-hosted.
Me.dataTextBlock.Text = "Is Browser Hosted: " & BrowserInteropHelper.Source.ToString()
Else
Me.dataTextBlock.Text = "Is not browser hosted"
End If
A Page can be host agnostic and, consequently, can be loaded into several different types of hosts, including a Frame, a NavigationWindow, or a browser. This can happen when you have a library assembly that contains one or more pages, and which is referenced by multiple standalone and browsable (XAML browser application (XBAP)) host applications.
제품 | 버전 |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
.NET 피드백
.NET은(는) 오픈 소스 프로젝트입니다. 다음 링크를 선택하여 피드백을 제공해 주세요.