Fresher
Fresher

Reputation: 523

wpf window is not activated

I am launching a wpf application from a process. I am activating the main window on the event handler OnContentRendered. It is not getting activated. It returns false.

I am launching the application from a foreground process only. So it should be succeeded.

I set window.Topmost = true which works well. But Activate() returns false.

Window is on the topmost but not activated.

(Previously I asked one question without a clarification of actual problem. so I removed it)

Upvotes: 0

Views: 2519

Answers (1)

James L
James L

Reputation: 16864

See the MSDN documentation for SetForegroundWindow, which lists the rules for bringing a window to the front.

https://msdn.microsoft.com/en-us/library/windows/desktop/ms633539(v=vs.85).aspx

As an aside, it's very unusual to be calling this from OnContentRendered

Upvotes: 1

Related Questions