TextBox KeyUp : TextBox Action « Windows Presentation Foundation « C# / CSharp Tutorial

<Window x:Class="WpfApplication1.Window1"
    Title="WPF " Height="300" Width="300">
    <DockPanel LastChildFill="True">
        <TextBox DockPanel.Dock="Top" KeyUp="TextBox_KeyEvent" />
        <TextBox Name="txtLog" HorizontalAlignment="Stretch" 
                 IsReadOnly="True" VerticalScrollBarVisibility="Visible"/>

using System;
using System.Windows;
using System.Windows.Input;

namespace WpfApplication1
    public partial class Window1 : Window
        public Window1()

        private void TextBox_KeyEvent(object sender, KeyEventArgs e)
            String msg = String.Format("{0} - {1}\n",e.RoutedEvent.Name, e.Key);

            txtLog.Text += msg;
WPF Text Box Key Up

24.14.TextBox Action
24.14.1.React to TextBox focus eventReact to TextBox focus event
24.14.2.TextBox MouseLeftButtonDown action and PreviewMouseLeftButtonDown actionTextBox MouseLeftButtonDown action and PreviewMouseLeftButtonDown action
24.14.3.Listen to TextBox text changed eventListen to TextBox text changed event
24.14.4.Handler for the PreviewKeyDown event on the TextBoxHandler for the PreviewKeyDown event on the TextBox
24.14.5.TextBox PreviewKeyDownTextBox PreviewKeyDown
24.14.6.TextBox KeyDown actionTextBox KeyDown action
24.14.7.TextBox PreviewKeyUpTextBox PreviewKeyUp
24.14.8.TextBox KeyUpTextBox KeyUp
24.14.9.TextBox TextInput eventTextBox TextInput event
24.14.10.TextBox PreviewTextInputTextBox PreviewTextInput
24.14.11.TextBox PreviewKeyDown, PreviewKeyUp, PreviewTextInput, KeyDown, KeyUp and TextChanged eventsTextBox PreviewKeyDown, PreviewKeyUp, PreviewTextInput, KeyDown, KeyUp and TextChanged events