ContentElement.LostFocus 事件


此元素失去邏輯焦點時發生。Occurs when this element loses logical focus.

 event System::Windows::RoutedEventHandler ^ LostFocus;
public event System.Windows.RoutedEventHandler LostFocus;
member this.LostFocus : System.Windows.RoutedEventHandler 
Public Custom Event LostFocus As RoutedEventHandler 




如果使用方法呼叫刻意強制焦點,但上一個鍵盤焦點存在於不同範圍中,則邏輯焦點會與鍵盤焦點不同。Logical focus differs from keyboard focus if focus is deliberately forced away by using a method call but the previous keyboard focus exists in a different scope. 在此案例中,鍵盤焦點會維持在何處,而 Focus 呼叫方法的元素仍會取得邏輯焦點。In this scenario, keyboard focus remains where it is, and the element where a Focus method is called still gets logical focus.

這個事件更精確的轉譯,是當 IsFocused 路由中專案的屬性值從變更為時引發 true falseA more precise interpretation of this event is that it is raised when the value of the IsFocused property of an element in the route changes from true to false.

因為此事件使用反升路由,所以失去焦點的元素可能是子項目,而不是實際附加事件處理常式的專案。Because this event uses bubbling routing, the element that loses focus might be a child element instead of the element where the event handler is actually attached. 檢查 Source 事件資料中的,以判斷取得焦點的實際元素。Check the Source in the event data to determine the actual element that gained focus.

路由事件資訊Routed Event Information

識別碼欄位Identifier field LostFocusEvent
路由策略Routing strategy 路由Bubbling
代理人Delegate RoutedEventHandler
  • 沒有對應的通道事件。There is no corresponding tunneling event.

  • 覆寫 OnLostFocus 以在衍生類別中為這個事件執行類別處理。Override OnLostFocus to implement class handling for this event in derived classes.