Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Application.StartupUri Property

Gets or sets a UI that is automatically shown when an application starts.

Namespace: System.Windows
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public Uri StartupUri { get; set; }
/** @property */
public Uri get_StartupUri ()

/** @property */
public void set_StartupUri (Uri value)

public function get StartupUri () : Uri

public function set StartupUri (value : Uri)

<object StartupUri="Uri" .../>

Property Value

A Uri that refers to the UI that automatically opens when an application starts.
Exception typeCondition

ArgumentNullException

StartupUri is set with a value of null.

You can use StartupUri to automatically load a UI resource when an application starts.

The following table shows the types of UI resources that can be loaded, and the type of window they are opened into, and the type of application that these resources can be set as the StartupUri.

Type

Window

Application Type

Window

Window

Standalone Only

NavigationWindow

NavigationWindow

Standalone Only

Page

NavigationWindow

Standalone/Browser-Hosted

UserControl

NavigationWindow

Standalone/Browser-Hosted

FlowDocument

NavigationWindow

Standalone/Browser-Hosted

PageFunction

NavigationWindow

Standalone/Browser-Hosted

Typically, you set the StartupUri property declaratively in XAML. However, you can set StartupUri programmatically, such as from a Startup event handler, which is useful if for applications that can only load the necessary UI resources at run time. For example, an application might wait until run time to load its resources if the name of the UI resource is stored in a configuration file.

Whether you set StartupUri declaratively or programmatically, the corresponding UI resource is not loaded until after the Startup event is handled. Consequently, you won't have access to the resulting window from either the Windows property or the MainWindow property when handling Startup.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.