Mega Code Archive
Implements a TextBlock to Display Key Data Captured from a TextBox Control
//File: Page.xaml.cs
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace SilverlightApplication3
{
public partial class MainPage : UserControl
{
int txtSize = 10;
public MainPage()
{
InitializeComponent();
txtBox.KeyDown += new KeyEventHandler(myCanvas_KeyDown);
txtBox.KeyUp += new KeyEventHandler(txtBox_KeyUp);
}
void myCanvas_KeyDown(object sender, KeyEventArgs e){
txt.FontSize = txtSize;
txt.Text = e.Key.ToString();
txtBox.Text = "";
txtSize += 5;
}
void txtBox_KeyUp(object sender, KeyEventArgs e){
txt.Text = "";
txtSize = 10;
}
}
}