Skip to content

TabView SelectedItem Issue #10277

@lhLife

Description

@lhLife

Describe the bug

After selecting any content in TabView, navigate to other pages, and when returning, the index cannot be found

`

    <TabView
        Grid.Row="1"
        Padding="0"
        HorizontalAlignment="Stretch"
        VerticalAlignment="Stretch"
        AddTabButtonCommand="{Binding AddCommand}"
        TabItemsSource="{Binding Works}"
        SelectedItem="{Binding SelectedWork,Mode=TwoWay}"
        TabWidthMode="Equal">
        <interactivity:Interaction.Behaviors>
            <core:EventTriggerBehavior EventName="TabCloseRequested">
                <core:InvokeCommandAction Command="{Binding CloseCommand}" />
            </core:EventTriggerBehavior>
        </interactivity:Interaction.Behaviors>
        <TabView.TabItemTemplate>
            <DataTemplate x:DataType="local:WorkViewModel">
                <TabViewItem Header="{x:Bind Title}" IconSource="{x:Bind Icon}">
                    <local:WorkPage DataContext="{x:Bind}"/>
                </TabViewItem>
            </DataTemplate>
        </TabView.TabItemTemplate>
    </TabView>

`

Steps to reproduce the bug

1.Create TabView( Page.NavigationCacheMode="Required")
2.Selected items
3.Navigate to other pages
4.Return to page

Expected behavior

No response

Screenshots

No response

NuGet package version

Windows App SDK 1.6.3: 1.6.241114003

Packaging type

No response

Windows version

No response

IDE

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions