I know this isn't as elegant as the other posts, but it's a more straightforward xaml/codebehind example of how to accomplish the same thing.
Xaml:
<StackPanel Orientation="Horizontal"> <TextBox Name="TextBox01" VerticalAlignment="Top" HorizontalAlignment="Left" Width="70" /> <Button Name="Button01" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,0,0,0" /> </StackPanel> CodeBehind:
Private Sub Window1_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded Button01.IsEnabled = False Button01.Content = "I am Disabled" End Sub Private Sub TextBox01_TextChanged(ByVal sender As Object, ByVal e As System.Windows.Controls.TextChangedEventArgs) Handles TextBox01.TextChanged If TextBox01.Text.Trim.Length > 0 Then Button01.IsEnabled = True Button01.Content = "I am Enabled" Else Button01.IsEnabled = False Button01.Content = "I am Disabled" End If End Sub