TextChangedEventArgs Třída

Definice

Poskytuje data pro událost TextChanged.

public ref class TextChangedEventArgs : System::Windows::RoutedEventArgs
public class TextChangedEventArgs : System.Windows.RoutedEventArgs
type TextChangedEventArgs = class
    inherit RoutedEventArgs
Public Class TextChangedEventArgs
Inherits RoutedEventArgs
Dědičnost
TextChangedEventArgs

Příklady

Následující příklad zobrazuje počet změn textu TextBox . Níže je uvedený kód XAML pro příklad.

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    
  x:Class="SDKSample.DetectChangedTextExample"
  Title="DetectChangedText">
  <StackPanel>
    <TextBox
      Name="tbCountingChanges"    
      TextChanged="textChangedEventHandler"
      TextWrapping="Wrap">
      Here is the initial text in the textbox.  Each time the contents of this box is changed, a change counter will
      be incremented and displayed in the TextBox below.  Note that the TextChanged event is called when the TextBox
      control is initially populated with text, so the changes counter starts of at 1.
    </TextBox>
    <TextBox Name="tbCounterText">0</TextBox>
    
  </StackPanel>  
</Page>

Níže je uvedený kód pro příklad.

using System.Windows.Controls;

namespace SDKSample
{
    public partial class DetectChangedTextExample : Page
    {
        // This is a counter for the number of times the TextChanged fires
        // for the tbCountingChanges TextBox.
        private int uiChanges = 0;

        // Event handler for TextChanged Event.
        private void textChangedEventHandler(object sender, TextChangedEventArgs args)
        {

            uiChanges++;
            if (tbCounterText != null)
            {
                tbCounterText.Text = uiChanges.ToString();
            }
        }
    }
}

Namespace SDKSample

    Partial Public Class DetectChangedTextExample
        Inherits Page

        ' This is a counter for the number of times the TextChanged fires
        ' for the tbCountingChanges TextBox.
        Private uiChanges As Integer = 0

        ' Event handler for TextChanged Event.
        Private Sub textChangedEventHandler(ByVal sender As Object,
                                            ByVal args As TextChangedEventArgs)

            uiChanges += 1
            If tbCounterText IsNot Nothing Then
                tbCounterText.Text = uiChanges.ToString()
            End If

        End Sub
    End Class
End Namespace

Konstruktory

Name Description
TextChangedEventArgs(RoutedEvent, UndoAction, ICollection<TextChange>)

Inicializuje novou instanci TextChangedEventArgs třídy pomocí zadané ID události, zpět akce a změny textu.

TextChangedEventArgs(RoutedEvent, UndoAction)

Inicializuje novou instanci TextChangedEventArgs třídy pomocí zadané ID události a vrátit akci zpět.

Vlastnosti

Name Description
Changes

Získá kolekci objektů, které obsahují informace o změnách, ke kterým došlo.

Handled

Získá nebo nastaví hodnotu, která označuje aktuální stav zpracování událostí pro směrovanou událost při cestě trasu.

(Zděděno od RoutedEventArgs)
OriginalSource

Získá původní zdroj sestavy určený čistým testováním hitů před případnou Source úpravou nadřazenou třídou.

(Zděděno od RoutedEventArgs)
RoutedEvent

Získá nebo nastaví přidruženou k RoutedEvent této RoutedEventArgs instanci.

(Zděděno od RoutedEventArgs)
Source

Získá nebo nastaví odkaz na objekt, který vyvolal událost.

(Zděděno od RoutedEventArgs)
UndoAction

Získá způsob, jak je zásobník zpět způsoben nebo ovlivněn touto změnou textu.

Metody

Name Description
Equals(Object)

Určuje, zda je zadaný objekt roven aktuálnímu objektu.

(Zděděno od Object)
GetHashCode()

Slouží jako výchozí funkce hash.

(Zděděno od Object)
GetType()

Získá Type aktuální instance.

(Zděděno od Object)
InvokeEventHandler(Delegate, Object)

Provede správné přetypování typu pro volání delegáta bezpečného TextChangedEventHandlerTextChanged typu pro událost.

MemberwiseClone()

Vytvoří mělkou kopii aktuálního Object.

(Zděděno od Object)
OnSetSource(Object)

Při přepsání v odvozené třídě poskytuje vstupní bod zpětného Source volání oznámení vždy, když se změní hodnota vlastnosti instance.

(Zděděno od RoutedEventArgs)
ToString()

Vrátí řetězec, který představuje aktuální objekt.

(Zděděno od Object)

Platí pro