Hello,
I have a problem with a telerik radtabcontrol which doesn't occur with the standard wpf tabcontrol.
My code is structured as follows :-
<telerik:RadTabControl> <telerik:RadTabItem Header="Locations" IsSelected="True"> // irrelevant stuff here </telerik:RadTabItem> <telerik:RadTabItem Header="Sources"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="*" /> </Grid.RowDefinitions> <telerik:RadTabControl ItemsSource="{Binding MyViewModel.Sources}" SelectedItem="{Binding MyViewModel.SelectedSource}"> <telerik:RadTabControl.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Style="{StaticResource SubTabTitle}" Text="{Binding DisplayName}"/> <Button Command="{Binding Path=DataContext.MyViewModel.RemoveSourceCommand,ElementName=LayoutRoot}" CommandParameter="{Binding}" ToolTip="Remove Source" Style="{StaticResource RemoveButton}" /> </StackPanel> </DataTemplate> </telerik:RadTabControl.ItemTemplate> <telerik:RadTabControl.ContentTemplate> <DataTemplate> <ScrollViewer> <StackPanel> <view:EditExcelSourceControl ViewModel="{Binding Path=DataContext.MyViewModel, ElementName=LayoutRoot}" Workbook="{Binding Path=DataContext.MyViewModel.SelectedExcelWorkbook,ElementName=LayoutRoot}" Visibility="{Binding Path=DataContext.MyViewModel.HasSelectedExcelWorkbook,ElementName=LayoutRoot,Converter={c:BooleanToVisibilityConverter}}"/> <view:EditTextSourceControl ViewModel="{Binding Path=DataContext.MyViewModel, ElementName=LayoutRoot}" File="{Binding Path=DataContext.MyViewModel.SelectedTextFile,ElementName=LayoutRoot}" Visibility="{Binding Path=DataContext.MyViewModel.HasSelectedTextFile,ElementName=LayoutRoot,Converter={c:BooleanToVisibilityConverter}}"/> </StackPanel> </ScrollViewer> </DataTemplate> </telerik:RadTabControl.ContentTemplate> </telerik:RadTabControl> </Grid> </telerik:RadTabItem></telerik:RadTabControl>Setting SelectedSource causes OnPropertyChange notifications for SelectedSource, and updates SelectedTextFile, SelectedExcelWorkbook, HasSelectedTextFile, HasSelectedExcelWorkbook as appropriate.
The user control has code as follows
<telerik:RadComboBox ItemsSource="{Binding DataContext.ViewModel.Points, ElementName=LayoutRoot}" SelectedValue="{Binding CurrentPoint}" Width="150"> <telerik:RadComboBox.ItemTemplate> <ItemContainerTemplate> <TextBlock Text="{Binding Name}" Margin="0" Padding="0" /> </ItemContainerTemplate> </telerik:RadComboBox.ItemTemplate></telerik:RadComboBox>
My problem is that if I switch between the toplevel tabcontrol items (from 'locations' tab to 'sources' tab), the object that the selectedsource is bound to on the nested tabcontrol will have it's currentpoint set to null.
If I modify the nested tabcontrol to be a simple WPF tabcontrol instead of a telerik:radtabcontrol, I do not have this problem where currentpoint is set to null.
Any help would be appreciated, thank you.