tcables
tcables

Reputation: 1307

WPF Window IsFocused

I have a window that I .show() that seems to be having troubles telling me if it is focused or not.

Me.IsFocused is always false if there is a textbox in the window. even if you click the textbox and minimize the window the textbox.IsFocused is True.

Is there a way to determine if the window is minimized or is behind another window without using windows API functions?

Thanks!

Upvotes: 1

Views: 1568

Answers (2)

Rune Andersen
Rune Andersen

Reputation: 1705

I think you are looking for the IsActive property for the window.

Upvotes: 5

BrokenGlass
BrokenGlass

Reputation: 161002

To find out whether a window is minimized you can use it's window state:

if (this.WindowState == System.Windows.WindowState.Minimized)
{
    //...
}

Upvotes: 0

Related Questions