This question is locked. New answers and comments are not allowed.
I create a tabcontrol which contains two tabitem
code as follows:
first , the test1 tabitem is selected , i click the button to get another button in test2 tabitem,it returns well
then i selected the test2 tabitem , i click the button to get the button in test1 tabitem ,it returns null
and then i selected the test1 tabitem again , click the button ,it returns null
what should i do if i selected the second tabitem, i want to get a control which in the first tabitem ,and suggestions?
thanks in advance
code as follows:
<
Grid
x:Name
=
"LayoutRoot"
>
<
telerik:RadTabControl
>
<
telerik:RadTabItem
Header
=
"Test1"
>
<
Button
Content
=
"Click"
Width
=
"80"
Height
=
"26"
x:Name
=
"Tbtn"
Click
=
"Tbtn_Click"
/>
</
telerik:RadTabItem
>
<
telerik:RadTabItem
Header
=
"Test2"
>
<
Button
Content
=
"Click"
Width
=
"80"
Height
=
"26"
x:Name
=
"btn"
Click
=
"btn_Click"
/>
</
telerik:RadTabItem
>
</
telerik:RadTabControl
>
</
Grid
>
private void btn_Click(object sender, RoutedEventArgs e)
{
Object obj = LayoutRoot.FindName("Tbtn");
}
private void Tbtn_Click(object sender, RoutedEventArgs e)
{
Object obj = LayoutRoot.FindName("btn");
}
first , the test1 tabitem is selected , i click the button to get another button in test2 tabitem,it returns well
then i selected the test2 tabitem , i click the button to get the button in test1 tabitem ,it returns null
and then i selected the test1 tabitem again , click the button ,it returns null
what should i do if i selected the second tabitem, i want to get a control which in the first tabitem ,and suggestions?
thanks in advance