Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

UIElement.OnLostFocus Method

Raises the LostFocus routed event by using the event data that is provided.

Namespace: System.Windows
Assembly: PresentationCore (in presentationcore.dll)

protected virtual void OnLostFocus (
	RoutedEventArgs e
)
protected void OnLostFocus (
	RoutedEventArgs e
)
protected function OnLostFocus (
	e : RoutedEventArgs
)
You cannot use methods in XAML.

Parameters

e

A RoutedEventArgs that contains event data. This event data must contains the identifier for the LostFocus event.

This method, although virtual, does have a default implementation that raises the event.

This On* method implementation is intended to raise the event, and this same method implementation is invoked internally to raise the event when the IsFocused property value changes. This implementation differs from some other Windows Presentation Foundation (WPF) On* implementations, which only provide a convenient way to add class handling for that event.

Notes to Inheritors: Unless you have a deliberate and unusual need to not raise the focus events, make sure that your implementation calls the base implementation. Otherwise, the LostFocus event is not raised during typical user operations that ordinarily set focus to this element. If you do not intend your element to be focusable, you can prevent the element from being focusable by setting Focusable to false.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2015 Microsoft