Nested tabcontrols problem

4 posts, 1 answers
  1. AshR
    AshR avatar
    16 posts
    Member since:
    Jan 2015

    Posted 07 Apr 2015 Link to this post


    I have a problem with a telerik radtabcontrol which doesn't occur with the standard wpf tabcontrol.

    My code is structured as follows :-

        <telerik:RadTabItem Header="Locations" IsSelected="True">
            // irrelevant stuff here
        <telerik:RadTabItem Header="Sources">
                    <RowDefinition Height="*" />
                <telerik:RadTabControl  ItemsSource="{Binding MyViewModel.Sources}"
                                        SelectedItem="{Binding MyViewModel.SelectedSource}">
                            <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}" />
                                    <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}}"/>

    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">
                <TextBlock Text="{Binding Name}" Margin="0" Padding="0" />


    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.




  2. AshR
    AshR avatar
    16 posts
    Member since:
    Jan 2015

    Posted 08 Apr 2015 Link to this post

    I have posted a support ticket on this issue.
  3. DevCraft banner
  4. Answer
    Petar Mladenov
    Petar Mladenov avatar
    2882 posts

    Posted 09 Apr 2015 Link to this post

    Hello AshR,

    Could you please check out the following help article and let us know if setting IsContentPreserved = True works for you ? Thank you in advance.

    RadTabControl How To Keep the Content State

    Petar Mladenov

    See What's Next in App Development. Register for TelerikNEXT.

  5. AshR
    AshR avatar
    16 posts
    Member since:
    Jan 2015

    Posted 09 Apr 2015 in reply to Petar Mladenov Link to this post

    Thank you Peter, that fixed the problem.
Back to Top