Creating Single-Instance WPF Applications
At times you may want to prevent the end user from launching multiple instances of your application.
To do this, open your MM .NET WPF Application, go to the Solution Explorer and open the MainEntry class.
Next, set the IsSingleInstance class-level variable to true (it's false by default). It's as simple as that!
If you look in the Main() method at the wireup of the anonymous method to the StartupNextInstance event you will see that by default when a second instance of the application is launched, it simply reactivates the main window of the original instance. If you want to change this behavior, this is application specific code you can change to meet your needs.
© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 05/23/17
Comment or report problem with topic
