Reputation: 111
<UserControl.DataContext>
<local:Model1 />
</UserControl.DataContext>
<Grid x:Name="LayoutRoot">
<telerik:RadTabControl Name="tab">
<telerik:RadTabItem x:Name="Tab0"
Height="30"
MinWidth="100"
Header="t1"
TabIndex="0">
<my:Control1 />
</telerik:RadTabItem>
<telerik:RadTabItem x:Name="Tab1"
Height="30"
MinWidth="100"
Header="t2"
TabIndex="1">
<my:Control2 />
</telerik:RadTabItem>
<telerik:RadTabItem x:Name="Tab2"
Height="30"
MinWidth="100"
Header="t3"
TabIndex="2">
<my:Control3 />
</telerik:RadTabItem>
</telerik:RadTabControl>
The following is my tabcontrol All controls in Radtabitems are showing table whose data is from database. All controls in Radtabitems have refresh function that use to refresh when date in database is refreshed.
The question is how can I refresh someone tab by itself after I do something in other tabs? Please help me. Thanks.
Upvotes: 0
Views: 1726
Reputation: 93
<my:Control2 x:Name = "myControl1"/>
and use selectionchanged in your .cs
.cs
selectionchanged....
{
//if itemIndex = 1
Control2 temp = myControl1;
//some veiwing model...for example: ViewControl2
if(temp.Datacontext is ViewControl2)
{
ViewControl2 Viewtmp = temp.Datacontext as ViewControl2;
Viewtmp.Refresh();//your refresh function can create in Viewtmp
}
}
Upvotes: 1