I am creating a TextBox and a Button dynamically using the following code:
TextBox
Button
Button btnClickMe = new Button(); btnClickMe.Content = \"Cli
You can get your original click handler to work by registering the name of the text box:
someStackPanel.RegisterName(txtNumber.Name, txtNumber);
This will then allow you to call FindName on the StackPanel and find the TextBox.