我到处找这个,但没有找到解决方案。
我想要的只是当我点击按钮时,文本框被启用,这样我们就可以在里面写东西了。
我试过了:
public void button11_Click(object sender, RoutedEventArgs e)
{
textbox11.Enabled = true;
}
这是xaml代码
<TextBox Name="textbox11" IsEnabled="False".....>
但显然它不起作用。我得到的错误:
'System.Windows.Controls.TextBox' does not contain a definition for 'Enabled' and no extension method 'Enabled' accepting a first argument of type 'System.Windows.Controls.TextBox' could be found (are you missing a using directive or an assembly reference?)
最佳答案
该控件没有名为“已启用”的属性。试试这个:
textbox11.IsEnabled = true;
注意"is"。
关于c# - 如何使用按钮启用/禁用文本框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34189010/