David Hawkins
David Hawkins

Reputation: 1067

wpf borderless window focus not firing

I have the following WPF window definition but the focus/lost focus events are not firing when I click away from the application, any ideas?

<Window x:Class="BevaClient.windowMain"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:l="clr-namespace:BevaClient"
    xmlns:forms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
    Title="VPN Tool" Height="500" Width="370"
    Focusable="True"
    WindowStyle="None"
    ResizeMode="NoResize"
    Topmost="True"
    Style="{StaticResource defaultWindow}"
    Loaded="Window_Loaded"
    GotFocus="Window_GotFocus"
    LostFocus="Window_LostFocus">

I have tried setting topmost to false to see if this was the issue but it makes no difference.

Any advice on this issue would be very much appreciated.

Thanks,

David

Upvotes: 1

Views: 627

Answers (1)

Rohit Vats
Rohit Vats

Reputation: 81253

Hook to Activated and Deactivated events instead.

Upvotes: 1

Related Questions