BrowserInteropHelper.IsBrowserHosted Proprietà
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Ottiene un valore che specifica se l'applicazione Windows Presentation Foundation corrente (macchine virtuali Windows) è ospitata nel browser.
public:
static property bool IsBrowserHosted { bool get(); };
public static bool IsBrowserHosted { get; }
static member IsBrowserHosted : bool
Public Shared ReadOnly Property IsBrowserHosted As Boolean
Valore della proprietà
true se l'applicazione è ospitata nel browser; in caso contrario, false.
Esempio
Nell'esempio seguente viene illustrato come usare BrowserInteropHelper.IsBrowserHosted per determinare se un Page oggetto è ospitato in un 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
Commenti
Un Page può essere host indipendente e, di conseguenza, può essere caricato in diversi tipi di host, tra cui , Frameun NavigationWindowo un browser. Ciò può verificarsi quando si dispone di un assembly di libreria che contiene una o più pagine e a cui si fa riferimento da più applicazioni host autonome ed esplorabili (applicazione browser XAML (XBAP) .