RichEditBox.TextChanging Event

Definition

Occurs synchronously when the text in the edit box starts to change, but before it is rendered.

C#
public event TypedEventHandler<RichEditBox,RichEditBoxTextChangingEventArgs> TextChanging;
XAML
<RichEditBox TextChanging="eventhandler"/>

Event Type

Remarks

For event data, see RichEditBoxTextChangingEventArgs.

The TextChanging event occurs synchronously before the new text is rendered. In contrast, the TextChanged event is asynchronous and occurs after the new text is rendered.

When the TextChanging event occurs, the Document property already reflects the new value (but it's not rendered in the UI). You typically handle this event to update the text value and selection before the text is rendered. This prevents the text flickering that can happen when text is rendered, updated, and re-rendered rapidly.

Poznámka

This is a synchronous event that can occur at times when changes to the XAML visual tree are not allowed, such as during layout. Therefore, you should limit code within the TextChanging event handler primarily to inspecting and updating the Document property. Attempting to perform other actions, such as showing a popup or adding/removing elements from the visual tree, might cause potentially fatal errors that can lead to a crash. We recommend that you perform these other changes either in a TextChanged event handler, or run them as a separate asynchronous operation.

Applies to

Produkt Verzie
Windows App SDK 0.8, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6

See also