Starts a Windows Presentation Foundation (WPF) application and opens the specified window.
Public Function Run ( _ window As Window _ ) As Integer
Dim instance As Application Dim window As Window Dim returnValue As Integer returnValue = instance.Run(window)
public int Run( Window window )
public: int Run( Window^ window )
public function Run( window : Window ) : int
You cannot use methods in XAML.
Run is called from a browser-hosted application (for example, an XAML browser application (XBAP)).
This overload extends the Run method to open the specified window after an application starts running.
If you define a code Application that opens a window when it starts running, you explicitly call Run.
If you create your Application using markup, or markup and code-behind, you can automatically open a window during using either of the following techniques:
Declaratively, by setting StartupUri.
Programmatically, by handling Startup.
The following example shows an application with a manually-created static entry point method that instantiates Application, before calling Run.
using System; using System.Windows; namespace CSharp { public class EntryPoint { // All WPF applications should execute on a single-threaded apartment (STA) thread [STAThread] public static void Main() { Application app = new Application(); app.Run(new Window()); } } }
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003