BrowserInteropHelper.IsBrowserHosted Propiedad

Definición

Obtiene un valor que especifica si la aplicación de Windows Presentation Foundation actual (WPF) está hospedada en el explorador.

public:
 static property bool IsBrowserHosted { bool get(); };
public static bool IsBrowserHosted { get; }
static member IsBrowserHosted : bool
Public Shared ReadOnly Property IsBrowserHosted As Boolean

Valor de propiedad

Es true si la aplicación está hospedada en el explorador; de lo contrario, es false.

Ejemplos

En el ejemplo siguiente se muestra cómo usar BrowserInteropHelper.IsBrowserHosted para determinar si Page se hospeda en un explorador.

// 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

Comentarios

Page puede ser independiente del host y, por lo tanto, se puede cargar en varios tipos diferentes de hosts, incluido Frame, NavigationWindow o un explorador. Esto puede ocurrir cuando tiene un ensamblado de biblioteca que contiene una o varias páginas, a las que hacen referencia varias aplicaciones host independientes y explorables (aplicación de explorador XAML (XBAP)).

Se aplica a