InitParams Property
Collapse the table of content
Expand the table of content

StartupEventArgs.InitParams Property


Gets the initialization parameters that were passed as part of HTML initialization of a Silverlight plug-in.

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

public IDictionary<string, string> InitParams { get; }

Property Value

Type: System.Collections.Generic.IDictionary<String, String>
The set of initialization parameters, as a dictionary with key strings and value strings.

The initialization parameters are passed as the initParams parameter when you embed the Silverlight plug-in in a Web page. For more information, see Integrating Silverlight with a Web Page.

Initialization parameters are not available to out-of-browser applications. However, you can use isolated storage to save initialization parameters before a user installs an application for out-of-browser use. You can then retrieve the parameters from isolated storage when the application launches outside the browser. For more information, see How to: Specify and Retrieve Custom Initialization Parameters.

The input format of this parameter starts as a single string with individual parameters delimited using a comma (,), and keys delimited from values using an equal sign (=). For example, "key1=value1,key2=value2,key3=value3". The delimiters are processed so that this API can provide them as a dictionary.

You can also access the initialization parameters through the SilverlightHost.InitParams property and in a IApplicationService.StartService method implementation through the ApplicationServiceContext.ApplicationInitParams property.

The following example code demonstrates how to use this property.

private void Application_Startup(object sender, StartupEventArgs e)
    Page p = new Page();
    this.RootVisual = p;

    // This assumes that Page.LayoutRoot exists and is a StackPanel.
    StackPanel layoutRoot = p.LayoutRoot; 

    // Display the custom initialization parameters.
    foreach (String key in e.InitParams.Keys)
        layoutRoot.Children.Add(new TextBlock() {
            Text = String.Format(
                "from InitParams: {0} = {1}", key, 

    // Display the URL parameters.
    foreach (String key in HtmlPage.Document.QueryString.Keys)
        layoutRoot.Children.Add(new TextBlock()
            Text = String.Format(
                "from QueryString: {0} = {1}", key, 


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

© 2015 Microsoft