using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Forms;
namespace WpfTestApp
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
string myName;
myName = "textBox1";
this.Controls.Find(myName);
}
}
}
The above code returns the following error:
Error 1 'WpfTestApp.MainWindow' does not contain a definition for 'Controls' and no extension method 'Controls' accepting a first argument of type 'WpfTestApp.MainWindow' could be found (are you missing a using directive or an assembly reference?)
this.
doesn't offer Controls
as an option through intellisense. But I've seen this.Contols.find(<name of control>)
in code examples before. But I can't seem to get it to work.
Any help would be appreciated, I'm using c# with Visual Studio 2010