WPF如何設置啟動窗口


    在做系統時,我們想在啟動時顯示自己想顯示的界面,和Winform不同的是它有兩種方法

1、在App.xaml中

<Application x:Class="WpfApp1.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:WpfApp1"
             Startup="Application_Startup">
    <Application.Resources>

2、在App.xaml上面的Starup中

<Application x:Class="WpfApp1.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:WpfApp1"
             Startup="Application_Startup">
    <Application.Resources>

定義一個啟動函數在后台代碼中對該函數進行修改

private void Application_Startup(object sender, StartupEventArgs e)
        {
            DialogFrm.Login login = new DialogFrm.Login();
            login.Show();
        }

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM