【发布时间】:2017-09-13 01:09:27
【问题描述】:
下图是我的项目。
这是我的项目代码,可满足您的测试需求。
<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="150" Width="400">
<Grid>
<TextBox Name="TextBox1" Width="200" Height="30" HorizontalAlignment="Left" Background="Pink" />
<Button Name="Button1" Content="Button1" Width="125" Height="30" HorizontalAlignment="Right" IsEnabled="False" />
</Grid>
</Window>
...
Class MainWindow
Private Sub MainWindow_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
TextBox1.Text = "Hello"
End Sub
Private Sub TextBox1_TextChanged(sender As System.Object, e As System.Windows.Controls.TextChangedEventArgs) Handles TextBox1.TextChanged
Button1.IsEnabled = True
End Sub
End Class
当我运行上面的代码时,由于 MainWindow_Loaded 事件触发了 TextBox1_TextChanged 事件。
您知道如何在 MainWindow_Loaded 之后触发 TextBox1_TextChanged 事件吗?
【问题讨论】: