简体   繁体   English

如何在 wpf 中创建登录弹出窗口?

[英]How can i create a login popup in wpf?

I am using Prism For wpf application.我正在使用 Prism For wpf 应用程序。 I want to create a login popup that opens before the main shell.我想创建一个在主 shell 之前打开的登录弹出窗口。 and if user enters his credentials successfully then the shell opens up and the popup should be closed.如果用户成功输入了他的凭据,那么 shell 就会打开,并且应该关闭弹出窗口。 currently i have created another window for login.目前我已经创建了另一个登录窗口。

Here is the login Window that opens on startup.这是在启动时打开的登录窗口。

In the Command Method i am doing this.在命令方法中,我正在这样做。

private void LoginToApplication() {
    Shell mainWindow = new Shell();
    Login loginPopup = new Login();
    loginPopup.Close();
    mainWindow.Show();
}

but i dont like a multiwindow app.但我不喜欢多窗口应用程序。 just want a popup so any suggestions will be helpful.只想要一个弹出窗口,所以任何建议都会有所帮助。

This is what regions are for.这就是区域的用途。 You should create a second region in your main window in front of all its other regions (call it "DialogRegion" for example).您应该在主窗口中的所有其他区域之前创建第二个区域(例如,将其称为“DialogRegion”)。 To show the login dialog, just navigate the dialog region to the login dialog.要显示登录对话框,只需将对话框区域导航到登录对话框。 When the dialog is closed, clear the dialog region.当对话框关闭时,清除对话框区域。 The blurring or shading of the area "outside" the active dialog could be in the style of the dialog region's hosting content control or just in the login dialog itself.活动对话框“外部”区域的模糊或阴影可以是对话框区域的托管内容控件的样式,也可以是登录对话框本身。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM