I got the issue and its resolved now.
I was using the below code
Button btnShowPopup = CurrentApplication.Find.ByName<Button>(
VisualTreeHost popupControl = CurrentApplication.Popups.FirstOrDefault();
Button btnCreateControl = popupControl.VisualTree.Find.ByName<Button>(
TextBox txtBox = popupControl.VisualTree.Find.ByName<TextBox>(
The mistake i have done is i took a reference of the popup in the variable popupControl.
reference will not get refreshed. I can do either of the statement to fix this.
Thanks for your reply Nelson.