Dynamic content tabs breaking changes in 2011 Q3

6 posts, 0 answers
  1. Trent Jones
    Trent Jones avatar
    49 posts
    Member since:
    Aug 2009

    Posted 30 Sep 2011 Link to this post

    Does anyone know of any breaking changes in RadTabControl for the 2011.2.0920 release?  I previously had a 2010.3.1314.1040 release.  We are dynamically loading content controls from usercontrols into tabs and everything was working fine. When i tried to upgrade i get an error about value is out of bounds/range or something and you can change tabs but the content is gone.  I think this is the error about the item being on the visual tree but don't understand why it's broken now.  i am reverting the changes and am going to try a slightly older version.

    Any help would be great.
  2. Trent Jones
    Trent Jones avatar
    49 posts
    Member since:
    Aug 2009

    Posted 03 Oct 2011 Link to this post

    Any updates anyone?  If i take out the template i don't get any issue
  3. DevCraft banner
  4. Trent Jones
    Trent Jones avatar
    49 posts
    Member since:
    Aug 2009

    Posted 03 Oct 2011 Link to this post

    I've narrowed this down to use of a <DataTemplate> within a setter in a style for radTabitem.  Code blows up sometime after the content of the tab is retrieved for the UI.  If i comment out the setter for the ContentTemplate the code works fine.  If i revert back to 2010 Q3 the code also works fine.

    TabContent.Value is a lazy property.

    <tControls:ContainerBindingCollection x:Key="mainTabContainerBindingTemplate">
                <tControls:ContainerBinding PropertyName="IsSelected"
                        Binding="{Binding Selected, Mode=TwoWay}" />
    </tControls:ContainerBindingCollection>
    <DataTemplate x:Name="SomeTemplate">
                <ContentPresenter Content="{Binding TabContent.Value}" />
    </DataTemplate>
    <Style x:Key="mainTabItemContainerStyle" TargetType="telerik:RadTabItem">
                <Setter Property="HeaderTemplate">
                    <Setter.Value>
                        <DataTemplate
                                tControls:ContainerBinding.ContainerBindings="{StaticResource mainTabContainerBindingTemplate}">
                            <Grid Cursor="Hand" ToolTipService.ToolTip="{Binding HeaderText}"
                                    ToolTipService.Placement="Mouse">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" MinWidth="60" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition MinHeight="30"/>
                                </Grid.RowDefinitions>
                                <ContentPresenter Grid.Column="0" Margin="0 1 3 1"
                                        VerticalAlignment="Center">
                                    <Image Source="{Binding IconPath}" MaxWidth="16" MaxHeight="16"/>
                                </ContentPresenter>
                                <TextBlock Grid.Column="1" TextTrimming="WordEllipsis" MaxWidth="80"
                                        VerticalAlignment="Center" Text="{Binding HeaderText}" />
                                <Button Grid.Column="2"  Width="12" Height="12" Margin="2 0 0 0"
                                        Visibility="{Binding IsClosable, ConverterParameter=IsClosable, Converter={StaticResource vc}}"
                                        Command="{Binding CloseTab}" CommandParameter="{Binding}">
                                    <Button.Template>
                                        <ControlTemplate>
                                            <Image Source="/TabbedExp;component/Images/close.png" Width="12" Height="12" Stretch="UniformToFill"/>
                                        </ControlTemplate>
                                    </Button.Template>
                                </Button>
                            </Grid>
                        </DataTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="ContentTemplate" Value="{StaticResource SomeTemplate}"/>
    </Style>
  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 05 Oct 2011 Link to this post

    Hello Trent Jones,

     We introduced some changes in the RadTabControl from Q1. Could you please try to use the SupressSelectedContentTemplateReapplying property set to true and let us know if the problem is resolved. You can find mroe info on this in the following help article:
    Configure the RadTabControl when Bound to a Collection of Visual Elements

    All the best,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Trent Jones
    Trent Jones avatar
    49 posts
    Member since:
    Aug 2009

    Posted 05 Oct 2011 Link to this post

    I do want to thank you for responding to my post.  I stumbled upon that property (and the tpoic) two days ago and got my solution working.  Question is was that kind of set automatically before as the project used to work in 2010.3?  Anyways, I really appreciate you confirming the fix.  I meant to come back up here and update but got sidetracked.  Thanks again.
  7. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 05 Oct 2011 Link to this post

    Hello Trent Jones,

     There were changes in the internal logic of the RadTabControl, comparing Q3 2010 and Q1 2011. This property (when set to true) somehow takes care that the control is backwards compatible in this situation.

    Best wishes,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top
DevCraft banner