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

    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.

     

     

     

  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. UI for WPF is Visual Studio 2017 Ready
  4. Answer
    Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 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


    Regards,
    Petar Mladenov
    Telerik
     

    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