WPF VB.Net

  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="Window1" Height="300" Width="300">
  
    
      
    

  


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