TextBox::TextChanged Event
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Occurs when content changes in the text box.
Assembly: System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.
User input or setting the Text property to a new value raises the TextChanged event.
If the Text property is set to the same string as the content in the TextBox, the event is not raised.
The TextChanged event is asynchronous. The event cannot be canceled.
Note: |
|---|
If the text and the selection is changed in a TextBox, the TextChanged event is raised before the SelectionChanged event. |
The following code snippets display a read-write text box and a read-only text box. As you type text in the read-write text box, the text is displayed in the read-only text box. This example is part of a larger example available in the TextBox class overview.
<TextBlock Margin="20,20,0,0" Text="Type Text Here"/> <TextBox x:Name="ReadWriteTB" TextChanged="ReadWriteTB_TextChanged" IsReadOnly="False" HorizontalAlignment="Left" Margin="20,5,0,0" Height="70" Width="200" /> <TextBlock Margin="20,20,0,0" Text="Read Only TextBox"/> <TextBox x:Name="ReadOnlyTB" IsReadOnly="True" HorizontalAlignment="Left" Margin="20,5,0,0" Height="70" Width="200" />
Note: