Para ver el artículo en inglés, active la casilla Inglés. También puede ver el texto en inglés en una ventana emergente si pasa el puntero del mouse por el texto.
Traducción
Inglés
Esta documentación está archivada y no tiene mantenimiento.

TextBoxBase.TextChanged (Evento)

Se produce cuando cambia el contenido en el elemento de texto.

Espacio de nombres:  System.Windows.Controls.Primitives
Ensamblado:  PresentationFramework (en PresentationFramework.dll)
XMLNS para XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

public event TextChangedEventHandler TextChanged
<object TextChanged="TextChangedEventHandler" .../>

Campo de identificador

TextChangedEvent

Estrategia de enrutamiento

Propagación

delegate

TextChangedEventHandler

Para un objeto TextBox, este evento se provoca cuando cambia su texto; para un objeto RichTextBox, este evento se provoca cuando cambia cualquier contenido o formato (por ejemplo, las imágenes, la tabla o el color de fondo).

This example shows one way to use the TextChanged event to execute a method whenever the text in a TextBox control has changed.

In the code-behind class for the XAML that contains the TextBox control that you want to monitor for changes, insert a method to call whenever the TextChanged event fires. This method must have a signature that matches what is expected by the TextChangedEventHandler delegate.

The event handler is called whenever the contents of the TextBox control are changed, either by a user or programmatically.

Note: This event fires when the TextBox control is created and initially populated with text.

In the Extensible Application Markup Language (XAML) that defines your TextBox control, specify the TextChanged attribute with a value that matches the event handler method name.


<TextBox  TextChanged="textChangedEventHandler">
  Here is the initial text in my TextBox.  Each time the contents of this TextBox are changed, 
  the TextChanged event  fires and textChangedEventHandler is called.
</TextBox>


In the code-behind class for the XAML that contains the TextBox control that you want to monitor for changes, insert a method to call whenever the TextChanged event fires. This method must have a signature that matches what is expected by the TextChangedEventHandler delegate.


// TextChangedEventHandler delegate method.
private void textChangedEventHandler(object sender, TextChangedEventArgs args)
{    
    // Omitted Code: Insert code that does something whenever
    // the text changes...
} // end textChangedEventHandler


The event handler is called whenever the contents of the TextBox control are changed, either by a user or programmatically.

Note: This event fires when the TextBox control is created and initially populated with text.

Comments

.NET Framework

Compatible con: 4, 3.5, 3.0

.NET Framework Client Profile

Compatible con: 4, 3.5 SP1

Windows 7, Windows Vista SP1 o posterior, Windows XP SP3, Windows Server 2008 (no se admite Server Core), Windows Server 2008 R2 (se admite Server Core con SP1 o posterior), Windows Server 2003 SP2

.NET Framework no admite todas las versiones de todas las plataformas. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.
Mostrar: