Files
docs-desktop/dotnet-desktop-guide/framework/wpf/app-development/how-to-determine-if-a-page-is-browser-hosted.md
Andy De George da363692ff Initial WPF content migrated (#17)
* Reset branch for WPF changes

* Convert BMP to PNG; fix link-out-of-scope err

* Add snippets for WPF... 6794 files!!!!

* Add missing snippets

* update file updated between migration

* Fix paths to include

* update breadcrumb and toc

* fix index links

* fix index links

* fix index links

* fix markdown
2020-09-04 09:46:28 -07:00

1.6 KiB

title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
title ms.date dev_langs helpviewer_keywords ms.assetid
How to: Determine If a Page is Browser Hosted 03/30/2017
csharp
vb
hosted pages in browser [WPF]
pages [WPF], hosted in browser
737e0f26-8371-49b4-9579-70879e51e1aa

How to: Determine If a Page is Browser Hosted

This example demonstrates how to determine if a xref:System.Windows.Controls.Page is hosted in a browser.

Example

A xref:System.Windows.Controls.Page can be host agnostic and, consequently, can be loaded into several different types of hosts, including a xref:System.Windows.Controls.Frame, a xref:System.Windows.Navigation.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.

The following example demonstrates how to use xref:System.Windows.Interop.BrowserInteropHelper.IsBrowserHosted%2A?displayProperty=nameWithType to determine if a xref:System.Windows.Controls.Page is hosted in a browser.

[!code-csharpHOWTOBrowserInteropHelperSnippets#IsBrowserHostedCODE] [!code-vbHOWTOBrowserInteropHelperSnippets#IsBrowserHostedCODE]

See also