ContentElement.OnLostFocus(RoutedEventArgs) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
利用提供的事件資料來 LostFocus 提升路由事件。
protected:
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 A 包含事件資料。 此事件資料必須包含事件 LostFocus 的識別碼。
備註
此方法雖為虛擬,但預設實作會提升事件。
此 On* 方法實作旨在引發事件,且當屬性值改變時 IsFocused ,內部也會呼叫此方法以觸發事件。 此實作與其他 Windows Presentation Foundation(WPF)On* 實作不同,後者僅提供方便的事件類別處理方式。
給繼承者的注意事項
除非你有刻意且特殊的需求不提焦點事件,否則請確保你的實作呼叫基礎實作。 否則, LostFocus 通常在將焦點放在該元素的典型使用者操作中,事件不會被觸發。 如果你不打算讓元素可聚焦,可以透過設定 Focusable 為 false來防止元素可聚焦。