Won't Fix
Last Updated: 23 Jan 2017 12:23 by ADMIN
ADMIN
Telerik Admin
Created on: 01 Sep 2011 19:27
Category: TabControl
Type: Bug Report
3
TabControl: SelectedIndex property fails to cast when read during animation
When the SelectedIndex property is read during animation the CLR wrapper will throw InvalidCastException because of invalid cast to int. The object returned from GetValue is DeferredReference object.
1 comment
ADMIN
Kalin
Posted on: 23 Jan 2017 12:23
Hi,

After further investigation it appears this is a framework issue appearing whenever the SelectedIndex is being changed using StoryBoard anitmation. It can be easily reproduced using WPF TabControl and animation that changes the SelectedIndex to 1 (after the index is changed try to select the first tab again):

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="30"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <Button Content="Change tab" Width="75">
        <Button.Triggers>
            <EventTrigger RoutedEvent="ButtonBase.Click">
                <BeginStoryboard>
                    <Storyboard>
                        <Int32AnimationUsingKeyFrames Storyboard.TargetProperty="(TabControl.SelectedIndex)" 
                                                    Storyboard.TargetName="tabControl">
                            <EasingInt32KeyFrame KeyTime="0" Value="1" />
                        </Int32AnimationUsingKeyFrames>
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>
        </Button.Triggers>
    </Button>
    <TabControl x:Name="tabControl" Grid.Row="1">
        <TabItem Header="TabItem1" />
        <TabItem Header="TabItem2" />
    </TabControl>
</Grid>

Regards,
Kalin