Mega Code Archive
Handler for the PreviewKeyDown event on the TextBox
//File:Window1.xaml.cs
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Media
Namespace WpfApplication1
Public Partial Class Window1
Inherits Window
Public Sub New()
InitializeComponent()
DataContext = Me
End Sub
'
Private Sub TextBox_PreviewKeyDown(sender As Object, e As RoutedEventArgs)
Dim textBox As TextBox = TryCast(sender, TextBox)
If textBox IsNot Nothing Then
textBox.Foreground = Brushes.Firebrick
End If
End Sub
End Class
End Namespace