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