Teknos
Teknos

Reputation: 411

Locking focus to a window WPF

I am adding a disclosure window to the start of my application. I want the window to be the only window that the user can interact with until it is closed. I have googled the heck out of it and have come up empty.

Thanks,

Joseph

Upvotes: 0

Views: 1691

Answers (1)

Ivan Danilov
Ivan Danilov

Reputation: 14777

You want modal dialog maybe? See ShowDialog() method.

For example:


App.xaml file:

<Application x:Class="WpfApplication3.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             Startup="Application_Startup" />

App.xaml.cs file:

public partial class App : Application
{
    private void Application_Startup(object sender, StartupEventArgs e)
    {
        var w = new YourDisclosureWindowClass();
        w.ShowDialog();
        // whatever you need to run you entire application
    }
}

Upvotes: 1

Related Questions