GotFocus="OnGotFocusHandler" LostFocus="OnLostFocusHandler">Click Or Tab To Give Keyboard Focus GotFocus="OnGotFocusHandler" LostFocus="OnLostFocusHandler">Click Or Tab To Give Keyborad Focus
//File:Window.xaml.vb Imports System Imports System.Windows Imports System.Windows.Controls Imports System.Windows.Data Imports System.Windows.Media Imports System.Windows.Input Namespace WpfApplication1 Public Partial Class Window1 Inherits Window Public Sub New() InitializeComponent() End Sub Private Sub OnGotFocusHandler(sender As Object, e As RoutedEventArgs) Dim tb As Button = TryCast(e.Source, Button) tb.Background = Brushes.Red End Sub Private Sub OnLostFocusHandler(sender As Object, e As RoutedEventArgs) Dim tb As Button = TryCast(e.Source, Button) tb.Background = Brushes.White End Sub End Class End Namespace