2010-11-19 54 views
13

這是一個非常非常簡單的問題,但我似乎無法找到答案。我有一個WPF應用程序,我爲其製作了一堆窗口。我已經決定,我希望有一個不同的窗口成爲第一個在應用程序啓動時打開的窗口。默認的第一個窗口是MainWindow,我該如何改變它,以便首先打開另一個窗口?C#WPF - 如何更改哪個窗口先打開

回答

23

打開App.xaml文件和更新的StartupUri:

<Application x:Class="WpfHacking.App" 
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
      StartupUri="MainWindow.xaml"> <!-- This is the line you want to update --> 
</Application> 
+2

啊,App.xaml中的一個地方,我忘了看!謝謝,我覺得這很容易 – cost 2010-11-19 05:00:57