I'm a WPF noob, having moved from WinForms and I'm trying to access the text in a textbox by name with a string, basically I need the WPF version of Controls.Find() and I can't seem to find anything that works. Here's my code;
<TextBox x:Name="amplitude0" HorizontalAlignment="Left" Height="20" TextWrapping="Wrap" VerticalAlignment="Top" Width="100" Canvas.Left="160" Canvas.Top="64" />
<TextBox x:Name="amplitude1" HorizontalAlignment="Left" Height="20" TextWrapping="Wrap" VerticalAlignment="Top" Width="100" Canvas.Left="280" Canvas.Top="64" />
...up to amplitude9. and the C#;
object textBox = new TextBox();
for (int n = 0; n <= 9; n++)
{
txtAmplitude = "amplitude" + n;
textBox = FindName(txtAmplitude);
amplitude[n] = textBox.text;
}
I've tried different functions but can't find anything that works, can someone point me in the right direction?
Thanks in advance
amplitude[]defined? AndFindName()?