BrowserInteropHelper.IsBrowserHosted Özellik

Tanım

Geçerli Windows Presentation Foundation (WPF) uygulamasının tarayıcı barındırılıp barındırılmadığını belirten bir değer alır.

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

Özellik Değeri

true uygulama tarayıcıda barındırılıyorsa; aksi takdirde , false.

Örnekler

Aşağıdaki örnekte, bir öğesinin tarayıcıda barındırılıp barındırılamadığını Page belirlemek için nasıl kullanılacağı BrowserInteropHelper.IsBrowserHosted gösterilmektedir.

// 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çıklamalar

a Page konağı agnostic olabilir ve sonuç olarak, bir , NavigationWindowveya bir tarayıcı da dahil olmak üzere Framebirkaç farklı konak türüne yüklenebilir. Bir veya daha fazla sayfa içeren ve birden çok tek başına ve gözatılabilir (XAML tarayıcı uygulaması (XBAP)) konak uygulaması tarafından başvurulan bir kitaplık derlemeniz olduğunda bu durum oluşabilir.

Şunlara uygulanır