This is a migrated thread and some comments may be shown as answers.

Dynamic content tabs breaking changes in 2011 Q3

5 Answers 37 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Trent Jones
Top achievements
Rank 1
Trent Jones asked on 30 Sep 2011, 02:10 PM
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.

5 Answers, 1 is accepted

Sort by
0
Trent Jones
Top achievements
Rank 1
answered on 03 Oct 2011, 02:57 PM
Any updates anyone?  If i take out the template i don't get any issue
0
Trent Jones
Top achievements
Rank 1
answered on 03 Oct 2011, 04:27 PM
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>
0
Petar Mladenov
Telerik team
answered on 05 Oct 2011, 09:11 AM
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 >>

0
Trent Jones
Top achievements
Rank 1
answered on 05 Oct 2011, 01:15 PM
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.
0
Petar Mladenov
Telerik team
answered on 05 Oct 2011, 01:27 PM
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 >>

Tags
TabControl
Asked by
Trent Jones
Top achievements
Rank 1
Answers by
Trent Jones
Top achievements
Rank 1
Petar Mladenov
Telerik team
Share this question
or