I am dynamically generating tabs based on databinding. After I change the datacontext I get the tabs I expect but none of the tabs are selected. I am expecting a tab (likely the first one) to be selected when this happens. I should mention I am using an older version R2 2017
<
CheckBox
x:Name
=
"cbox"
Click
=
"CheckBox_Checked"
>Click Me</
CheckBox
>
<
telerik:RadTabControl
x:Name
=
"tabCtrl"
DisplayMemberPath
=
"Name"
ItemsSource
=
"{Binding TabItems}"
Height
=
"250"
/>
private
void
TabCtrl_DataContextChanged (
object
sender, DependencyPropertyChangedEventArgs e)
{
// Attempting to fixt the problem here. Tabs are still unselected when changing data context
this
.tabCtrl.SelectedIndex = 0;
}
/// <summary>
/// Simulating a data context change in a complicated MVVM scenario here
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private
void
CheckBox_Checked (
object
sender, RoutedEventArgs e)
{
if
( cbox.IsChecked ==
true
)
{
this
.tabCtrl.DataContext = m_mainVm.TabViewModelA;
}
else
{
this
.tabCtrl.DataContext = m_mainVm.TabViewModelB;
}
}