Compartir a través de


StartupEventHandler Delegate

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Represents the method that will handle the Application.Startup event.

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

Syntax

'Declaration
Public Delegate Sub StartupEventHandler ( _
    sender As Object, _
    e As StartupEventArgs _
)
public delegate void StartupEventHandler(
    Object sender,
    StartupEventArgs e
)

Parameters

Examples

The following code shows how to handle the Startup event.

Partial Public Class App
    Inherits Application

    public Sub New()
        InitializeComponent()
    End Sub

    Private Sub Application_Startup(ByVal o As Object, _
        ByVal e As StartupEventArgs) Handles Me.Startup

        ' Detect when the application starts up.

    End Sub

End Class
using System.Windows; // Application, StartupEventArgs

namespace SilverlightApplication
{
    public partial class App : Application
    {
        public App()
        {
            this.Startup += this.Application_Startup;
            InitializeComponent();
        }

        private void Application_Startup(object sender, StartupEventArgs e)
        {
            // Detect when the application starts up.
        }
    }
}

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

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

Platforms

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