-Code in Zusammenhangchange 'IsEnabled' für WPF texbox in Benutzersteuerelements (Code-Behind)
private void button2_Click(object sender, RoutedEventArgs e)
{
edit();
}
public void edit()
{
textBox1.IsEnabled = true;
textBox2.IsEnabled = true;
textBox3.IsEnabled = true;
textBox4.IsEnabled = true;
textBox5.IsEnabled = true;
textBox6.IsEnabled = true;
textBox7.IsEnabled = true;
textBox8.IsEnabled = true;
textBox9.IsEnabled = true;
textBox10.IsEnabled = true;
textBox11.IsEnabled = true;
textBox12.IsEnabled = true;
textBox13.IsEnabled = true;
textBox14.IsEnabled = true;
textBox15.IsEnabled = true;
textBox16.IsEnabled = true;
textBox17.IsEnabled = true;
textBox18.IsEnabled = true;
}
I durchführen möchte, dass die eine einfache for-Schleife oben verwenden, das durch 1-18-Schleifen.
Ich habe die followng Methode versucht, aber nicht wie
bestimmtfor(i=0;i<19;i++)
{
textBox"" + i + "".IsVisible = true;
}
Ich bin neu in WPF, und ich bin die Migration meiner App von WinForms zu WPF.
Wäre es in WinForms arbeiten? Ich sehe eine seltsame Syntax 'textBox" "+ i +" ".IsVisible = true;' – Alex