Redigera

Dela via


ContentElement.OnGotFocus(RoutedEventArgs) Method

Definition

Raises the GotFocus routed event by using the event data provided.

protected:
 virtual void OnGotFocus(System::Windows::RoutedEventArgs ^ e);
protected virtual void OnGotFocus (System.Windows.RoutedEventArgs e);
abstract member OnGotFocus : System.Windows.RoutedEventArgs -> unit
override this.OnGotFocus : System.Windows.RoutedEventArgs -> unit
Protected Overridable Sub OnGotFocus (e As RoutedEventArgs)

Parameters

e
RoutedEventArgs

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

Remarks

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. The OnGotFocus 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 GotFocus 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. Note that by default a Focusable is not focusable, therefore setting Focusable deliberately might not be necessary.

Applies to

See also