Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TabViewItem can no longer be a child of TabView #1844

Closed
michael-hawker opened this issue Jan 14, 2020 · 3 comments · Fixed by #1845
Closed

TabViewItem can no longer be a child of TabView #1844

michael-hawker opened this issue Jan 14, 2020 · 3 comments · Fixed by #1845
Labels
area-TabView bug Something isn't working team-Controls Issue for the Controls team

Comments

@michael-hawker
Copy link
Collaborator

Describe the bug
If you try and add a TabViewItem as the content of a TabView as in this docs example you get an error:

TabView does not support TabViewItem as content.

(I feel like this may be a regression as the docs were probably valid at one point.)

In WinUI 2.3, you need to instead encase the TabViewItems in a special <muxc:TabView.TabItems> property.

Steps to reproduce the bug

Steps to reproduce the behavior:

  1. Open XAML Studio
  2. Paste in the example from the docs:
    <muxc:TabView HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <muxc:TabViewItem Header="Home" />
        <muxc:TabViewItem Header="Document 1" />
        <muxc:TabViewItem Header="Document 2" />
        <muxc:TabViewItem Header="Document 3" />

        <muxc:TabView.TabStripHeader>
            <Grid x:Name="ShellTitlebarInset" Background="Transparent" />
        </muxc:TabView.TabStripHeader>
        <muxc:TabView.TabStripFooter>
            <Grid x:Name="CustomDragRegion" Background="Transparent" />
        </muxc:TabView.TabStripFooter>
    </muxc:TabView>

Note: the Icon property from the example was also removed, as modified the above.

Expected behavior
Should display tabs without needing to wrap in TabItems property:

        <muxc:TabView.TabItems>
            <muxc:TabViewItem Header="Home" />
            <muxc:TabViewItem Header="Document 1" />
            <muxc:TabViewItem  Header="Document 2" />
            <muxc:TabViewItem  Header="Document 3" />
        </muxc:TabView.TabItems>

Version Info
WinUI 2.3.191129002

Additional context
Reference #1332

@ranjeshj
Copy link
Contributor

@stmoy It looks like this is not working because TabItems is not the content property for TabView. We can either update the sample or make it as the content property.

@ranjeshj ranjeshj added area-TabView team-Controls Issue for the Controls team bug Something isn't working labels Jan 14, 2020
@michael-hawker
Copy link
Collaborator Author

It'd be nice to see it as the content property, as that's a pretty standard practice. It's always nice to be able to type less. 🙂

@stmoy
Copy link
Contributor

stmoy commented Jan 15, 2020

In the same way that one can add ListViewItems to ListView, I feel that we should be able to do the same with TabView.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-TabView bug Something isn't working team-Controls Issue for the Controls team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants