dan gibson
dan gibson

Reputation: 3665

Bring window to front with Xamarin.Mac

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

Answers (1)

m00seDrip
m00seDrip

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

Related Questions