To reach testTb you must do
var testTb = (TextBox)PageContent.FindName("testTb");
//use testTb as you want.
this happens because testTb is in a different scope
EDIT:
If your XAML is exactly like this:
<helpers:BasePage.PageContent>
<TextBox x:Name="testTb" />
</helpers:BasePage.PageContent>
then you should be able to use TextBox doing this:
var testTb = (TextBox)PageContent;
testTb.Text = "Whatever you want to do";
EDIT
This is a class you need
MyVisualTreeHelper.cs
public static class MyVisualTreeHelper
{
public static T FindVisualChild<T>(this FrameworkElement obj, string childName) where T : FrameworkElement
{
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
{
FrameworkElement child = (FrameworkElement)VisualTreeHelper.GetChild(obj, i);
if (child != null && child is T && child.Name == childName)
return (T)child;
else
{
T childOfChild = FindVisualChild<T>(child, childName);
if (childOfChild != null)
return childOfChild;
}
}
return null;
}
}
and Here's how you use it:
var testTb = SlideControl.PageContent.FindVisualChild<TextBlock>("testTb");
if (testTb != null)
testTb.Text = "test2";