Export (0) Print
Expand All

Application.Host Property

Silverlight

Gets various details about the Silverlight application's host.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)

'Declaration
Public ReadOnly Property Host As SilverlightHost

Property Value

Type: System.Windows.Interop.SilverlightHost
A SilverlightHost that provides various details about the Silverlight host application.

Much of the information that is reported by a SilverlightHost object is the same information that could be obtained from properties of the Silverlight plug-in object in the JavaScript API. For instance, the Background color that was set as part of the Silverlight plug-in instantiation can be obtained from the Host.Background property. The "sub-objects" (Content and Settings) of the Silverlight plug-in in the JavaScript API are properties with object values (Content and Settings) in the managed API.

The following example shows how to use Host to get the path to the Silverlight application package.

Run this sample


<UserControl x:Class="SilverlightApplication.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Grid>
        <TextBlock Text="{Binding Source}" />
    </Grid>

</UserControl>



Partial Public Class Page
    Inherits UserControl

    Public Sub New()

        InitializeComponent()

        Me.DataContext = App.Current.Host

    End Sub

End Class


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft