TextChangedEventArgs クラス

定義

TextChanged イベントのデータを提供します。

public ref class TextChangedEventArgs : System::Windows::RoutedEventArgs
public class TextChangedEventArgs : System.Windows.RoutedEventArgs
type TextChangedEventArgs = class
    inherit RoutedEventArgs
Public Class TextChangedEventArgs
Inherits RoutedEventArgs
継承
TextChangedEventArgs

次の使用例は、 TextBox のテキストが変更された回数を表示します。 この例の XAML コードを次に示します。

<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>

以下はこの例の背後のコードです。

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

コンストラクター

名前 説明
TextChangedEventArgs(RoutedEvent, UndoAction, ICollection<TextChange>)

指定したイベント ID、元に戻す操作、およびテキストの変更を使用して、 TextChangedEventArgs クラスの新しいインスタンスを初期化します。

TextChangedEventArgs(RoutedEvent, UndoAction)

指定したイベント ID と元に戻す操作を使用して、 TextChangedEventArgs クラスの新しいインスタンスを初期化します。

プロパティ

名前 説明
Changes

発生した変更に関する情報を含むオブジェクトのコレクションを取得します。

Handled

ルーティング イベントがルートを移動する際のイベント処理の現在の状態を示す値を取得または設定します。

(継承元 RoutedEventArgs)
OriginalSource

親クラスによって可能な Source 調整の前に、純粋ヒット テストによって決定された元のレポート ソースを取得します。

(継承元 RoutedEventArgs)
RoutedEvent

このRoutedEvent インスタンスに関連付けられているRoutedEventArgsを取得または設定します。

(継承元 RoutedEventArgs)
Source

イベントを発生させたオブジェクトへの参照を取得または設定します。

(継承元 RoutedEventArgs)
UndoAction

元に戻すスタックがこのテキスト変更の原因または影響を受ける方法を取得します。

メソッド

名前 説明
Equals(Object)

指定したオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
InvokeEventHandler(Delegate, Object)

適切な型キャストを実行して、TextChanged イベントのタイプ セーフ TextChangedEventHandler デリゲートを呼び出します。

MemberwiseClone()

現在の Objectの簡易コピーを作成します。

(継承元 Object)
OnSetSource(Object)

派生クラスでオーバーライドされると、インスタンスの Source プロパティの値が変更されるたびに通知コールバック エントリ ポイントを提供します。

(継承元 RoutedEventArgs)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象