ContentElement.OnLostFocus(RoutedEventArgs) ContentElement.OnLostFocus(RoutedEventArgs) ContentElement.OnLostFocus(RoutedEventArgs) ContentElement.OnLostFocus(RoutedEventArgs) Method


使用所提供的事件資料引發 LostFocus 路由事件。Raises the LostFocus routed event by using the event data that is provided.

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


RoutedEventArgs RoutedEventArgs RoutedEventArgs RoutedEventArgs

包含事件資料的 RoutedEventArgsA RoutedEventArgs that contains event data. 此事件資料必須包含 LostFocus 事件的識別項。This event data must contain the identifier for the LostFocus event.


此方法中,雖然是虛擬的沒有預設實作會引發事件。This method, although virtual, does have a default implementation that raises the event.

在這*方法實作用來引發事件,這個相同的方法實作是在內部叫用來引發事件時IsFocused屬性值變更。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. 此實作在相異從一些其他 Windows Presentation Foundation (WPF)*只提供便利的方式來加入類別處理該事件的實作。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.


除非您有不會引發焦點事件變成故意或不尋常的需要,請確定您的實作會呼叫基底實作。Unless you have a deliberate and unusual need to not raise the focus events, make sure that your implementation calls the base implementation. 否則,LostFocus通常將焦點設定至這個項目的一般使用者作業期間將不會引發事件。Otherwise, the LostFocus event is not raised during typical user operations that ordinarily set focus to this element. 如果您不想要您可設定焦點的項目,您可以防止項目設定成為可設定焦點FocusablefalseIf you do not intend your element to be focusable, you can prevent the element from being focusable by setting Focusable to false.