RichEditBox.TextChanging イベント

定義

編集ボックス内のテキストの変更が開始され、レンダリングされる前に同期的に発生します。

// Register
event_token TextChanging(TypedEventHandler<RichEditBox, RichEditBoxTextChangingEventArgs const&> const& handler) const;

// Revoke with event_token
void TextChanging(event_token const* cookie) const;

// Revoke with event_revoker
RichEditBox::TextChanging_revoker TextChanging(auto_revoke_t, TypedEventHandler<RichEditBox, RichEditBoxTextChangingEventArgs const&> const& handler) const;
public event TypedEventHandler<RichEditBox,RichEditBoxTextChangingEventArgs> TextChanging;
function onTextChanging(eventArgs) { /* Your code */ }
richEditBox.addEventListener("textchanging", onTextChanging);
richEditBox.removeEventListener("textchanging", onTextChanging);
- or -
richEditBox.ontextchanging = onTextChanging;
Public Custom Event TextChanging As TypedEventHandler(Of RichEditBox, RichEditBoxTextChangingEventArgs) 
<RichEditBox TextChanging="eventhandler"/>

イベントの種類

注釈

イベント データについては、「 RichEditBoxTextChangingEventArgs」を参照してください。

TextChanging イベントは、新しいテキストがレンダリングされる前に同期的に発生します。 これに対し、 TextChanged イベントは非同期であり、新しいテキストがレンダリングされた後に発生します。

TextChanging イベントが発生すると、 Document プロパティには新しい値が既に反映されます (ただし、UI ではレンダリングされません)。 通常、このイベントを処理して、テキストがレンダリングされる前にテキストの値と選択範囲を更新します。 これにより、テキストが迅速にレンダリング、更新、再レンダリングされたときに発生する可能性があるテキストのちらつきを防ぐことができます。

注意

これは同期イベントであり、レイアウト中など、XAML ビジュアル ツリーへの変更が許可されない場合に発生する可能性があります。 したがって、TextChanging イベント ハンドラー内のコードは、主に Document プロパティの検査と更新に制限する必要があります。 ポップアップの表示やビジュアル ツリーからの要素の追加/削除など、他のアクションを実行しようとすると、致命的なエラーが発生する可能性があり、クラッシュする可能性があります。 これらの他の変更は 、TextChanged イベント ハンドラーで実行するか、別の非同期操作として実行することをお勧めします。

適用対象

こちらもご覧ください