Reputation: 3665
I have a window that uses FileSystemWatcher to pop up when a new file is created. How can I get it to actually display / become the foreground window? MakeKeyAndOrderFront doesn't make it pop up infront of other windows.
Upvotes: 2
Views: 814
Reputation: 4021
To make my window appear front, centered and focused I have had success with the following:
NSApplication app = NSApplication.SharedApplication;
app.ActivateIgnoringOtherApps(true);
var win = new PreferencesWindowController().Window;
win.Center();
win.MakeKeyAndOrderFront(this);
Upvotes: 2