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();
        }

  

posted @ 2018-03-15 11:12  风轻云淡wjr  阅读(9589)  评论(0编辑  收藏  举报