开发者

How to minimize owner window when a modal is showing?

I have an application which on the first load it will show a modal window for user login (a borderless window). Now when the user wants to minimize the application by clicking the minimize button of the main window, it 开发者_如何学JAVAcan't be done cause the main window is locked by the modal window. When the user tries to click the application taskbar it still won't minimize.

How can I allow the application to be minimized when a modal is showing (using the main window taskbar)?


Your question is a little unclear to me. If you mean, can you minimize the main window while the modal dialog is up, then, no - the modal dialog has control (and that's the purpose of a modal dialog).

However, you can minimize the main window (or hide it, or whatever) before you show the dialog:

void btnLogin_Click(object sender, RoutedEventArgs e)
{
    MyLoginDialog dialog = new MyLoginDialog();
    dialog.WindowStartupLocation = WindowStartupLocation.CenterScreen;
    dialog.WindowState = WindowState.Normal;

    this.WindowState= WindowState.Minimized;
    // Can also do this to completely hide the main window:
    // this.Visibility = Visibility.Collapsed;

    dialog.ShowDialog();            
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜