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

TabbedCommandBar not working Windows App SDK 0.8 #4085

Closed
nlogozzo opened this issue Jun 26, 2021 · 14 comments · Fixed by #4092 or #4132
Closed

TabbedCommandBar not working Windows App SDK 0.8 #4085

nlogozzo opened this issue Jun 26, 2021 · 14 comments · Fixed by #4092 or #4132
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior Completed 🔥 sdkcheck 🏁
Projects
Milestone

Comments

@nlogozzo
Copy link

When will the TabbedCommandBar be ported to Project Reunion?

@ghost ghost added the needs triage 🔍 label Jun 26, 2021
@ghost
Copy link

ghost commented Jun 26, 2021

Hello nlogozzo, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

@michael-hawker
Copy link
Member

@nlogozzo it's already been in our Windows App SDK releases as have all our controls. If you're having a specific problem with getting it to work, please provide more details.

See our discussion on the release here: #3912

@michael-hawker michael-hawker added question ❔ Issues or PR require more information and removed needs triage 🔍 labels Jun 28, 2021
@nlogozzo
Copy link
Author

@michael-hawker I have the following XAML:

<Window
    x:Class="NickvisionApp.Views.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:NickvisionApp.Views"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:wct="using:CommunityToolkit.WinUI.UI.Controls"
    mc:Ignorable="d">
    <Grid Background="{ThemeResource SystemControlAcrylicElementBrush}">
        <wct:TabbedCommandBar Name="Ribbon" HorizontalAlignment="Stretch" VerticalAlignment="Top">
            <wct:TabbedCommandBar.MenuItems>
                <wct:TabbedCommandBarItem Header="Home">
                    <AppBarButton Label="Open Folder" Icon="OpenLocal" Click="OpenFolder"/>
                </wct:TabbedCommandBarItem>
            </wct:TabbedCommandBar.MenuItems>
        </wct:TabbedCommandBar>

        <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,80,0,0">
            <TextBox HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,10,0,0" Width="300" 
                     Header="Name" PlaceholderText="Enter name here"/>
        </Grid>

        <InfoBar Name="InfoBar" HorizontalAlignment="Stretch" VerticalAlignment="Bottom"/>
    </Grid>
</Window>

And this is the resulting window:
image

Again using Project Reunion 0.8 with WinUI3 and have the following package CommunityToolkit.WinUI.UI.Controls V7.0.3 installed for WCT

@michael-hawker
Copy link
Member

michael-hawker commented Jun 29, 2021

@azchohfi can you double-check with 0.8? What do you see?

@michael-hawker michael-hawker added bug 🐛 An unexpected issue that highlights incorrect behavior sdkcheck 🏁 and removed question ❔ Issues or PR require more information labels Jun 29, 2021
@michael-hawker michael-hawker changed the title TabbedCommandBar on Project Reunion TabbedCommandBar not working Windows App SDK 0.8 Jun 29, 2021
@michael-hawker
Copy link
Member

Thanks Alex for letting me know this is due to microsoft/microsoft-ui-xaml#3502, we can at least provide a work-around for now when we ship an update.

@nlogozzo could you try adding a property to the XAML initialization of the control?

<wct:TabbedCommandBar DefaultStyleResourceUri="ms-appx:///CommunityToolkit.WinUI.UI.Controls.Core/Themes/Generic.xaml" ... >

@nlogozzo
Copy link
Author

@michael-hawker My New Xaml:

<Window
    x:Class="NickvisionApp.Views.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:NickvisionApp.Views"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:wct="using:CommunityToolkit.WinUI.UI.Controls"
    mc:Ignorable="d">
    <Grid Background="{ThemeResource SystemControlAcrylicElementBrush}">
        <wct:TabbedCommandBar Name="Ribbon" DefaultStyleResourceUri="ms-appx:///CommunityToolkit.WinUI.UI.Controls.Core/Themes/Generic.xaml" HorizontalAlignment="Stretch" VerticalAlignment="Top">
            <wct:TabbedCommandBar.MenuItems>
                <wct:TabbedCommandBarItem Header="Home">
                    <AppBarButton Label="Open Folder" Icon="OpenLocal" Click="OpenFolder">
                        <AppBarButton.KeyboardAccelerators>
                            <KeyboardAccelerator Modifiers="Control" Key="O"/>
                        </AppBarButton.KeyboardAccelerators>
                    </AppBarButton>
                </wct:TabbedCommandBarItem>

                <wct:TabbedCommandBarItem Header="Help">
                    <AppBarButton Label="GitHub Repo" Icon="Library" Click="GitHubRepo"/>

                    <AppBarButton Label="Report a Bug" Icon="ReportHacked" Click="ReportABug"/>

                    <AppBarButton Label="Buy Me a Coffee" Icon="Like" Click="BuyMeACoffee"/>

                    <AppBarSeparator/>

                    <AppBarButton Label="Changelog" Icon="List" Click="Changelog"/>

                    <AppBarButton Label="About" Icon="Help" Click="About">
                        <AppBarButton.KeyboardAccelerators>
                            <KeyboardAccelerator Modifiers="None" Key="F1"/>
                        </AppBarButton.KeyboardAccelerators>
                    </AppBarButton>
                </wct:TabbedCommandBarItem>
            </wct:TabbedCommandBar.MenuItems>

            <wct:TabbedCommandBar.PaneFooter>
                <CommandBar Background="Transparent" DefaultLabelPosition="Right">
                    <AppBarButton Label="Check for Updates" Icon="Sync" Click="CheckForUpdates"/>
                    
                    <AppBarButton Label="Settings" Icon="Setting" Click="Settings"/>
                </CommandBar>
            </wct:TabbedCommandBar.PaneFooter>
        </wct:TabbedCommandBar>

        <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,80,0,0">
            <TextBox HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,10,0,0" Width="300" 
                     Header="Name" PlaceholderText="Enter name here"/>
        </Grid>

        <InfoBar Name="InfoBar" HorizontalAlignment="Stretch" VerticalAlignment="Bottom"/>
    </Grid>
</Window>

And the new result:
image

The tabs are missing now

@michael-hawker
Copy link
Member

@yoshiask so originally TabbedCommandBar was based off the system NavigationView. WinUI removed the NavigationViewList to replace it with an ItemsRepeater a few versions ago, so since WinUI 3 is based off the latest WinUI 2.x, it means the template is no longer valid.

Now that we have the dependency on WinUI directly anyway, think you'd have time to update the current Toolkit version to be based off the latest WinUI 2.6 templates? That way it should just be a smooth transition to our WinUI 3 branch.

Let us know, thanks!

(@RosarioPulella when you have a minute, would you mind opening a PR to update our WinUI version to the latest 2.6 release? We should do a quick check of the Sample App to see if any controls have broken (like ColorPicker/Button, TokenizingTextBox, etc...))

@nlogozzo
Copy link
Author

@michael-hawker So no work around for this as of now? Have to wait for an update...

@yoshiask
Copy link
Contributor

yoshiask commented Jul 2, 2021

@yoshiask so originally TabbedCommandBar was based off the system NavigationView. WinUI removed the NavigationViewList to replace it with an ItemsRepeater a few versions ago, so since WinUI 3 is based off the latest WinUI 2.x, it means the template is no longer valid.

Now that we have the dependency on WinUI directly anyway, think you'd have time to update the current Toolkit version to be based off the latest WinUI 2.6 templates? That way it should just be a smooth transition to our WinUI 3 branch.

Been a bit busy with my day job, but I should have time this week. Hopefully I can get it done before next week.

@michael-hawker
Copy link
Member

We'll fix this as part of a different PR for Windows App SDK

@michael-hawker michael-hawker added this to the 7.1 milestone Jul 23, 2021
@michael-hawker michael-hawker added this to To do in Bugs 7.1 via automation Jul 23, 2021
@ghost ghost removed the Completed 🔥 label Jul 23, 2021
@ghost ghost added the In-PR 🚀 label Jul 26, 2021
@michael-hawker
Copy link
Member

FYI @azchohfi this is all working now in the #4132 PR, so hopefully you won't have problems when merged in the WinUI 3 branch.

@ghost ghost closed this as completed in #4132 Jul 30, 2021
Bugs 7.1 automation moved this from To do to Done Jul 30, 2021
ghost pushed a commit that referenced this issue Jul 30, 2021
## Fixes #4085

Previously, `TabbedCommandBar` used the system XAML `NavigationView`, but this doesn't work on WinUI 3. This PR makes the control functional on WinUI 2.6+ and 3.x, albeit with a few style issues (which will be fixed either in this PR or a later one).

## PR Type
What kind of change does this PR introduce?

Bugfix
Refactoring (no functional changes, no api changes)


## What is the current behavior?
See #4085


## What is the new behavior?
- `TabbedCommandBar` now inherits from MUXC `NavigationView` and uses 2.6 styles
- `Normal*` and `ContextualTabTemplate` now use MUXC `NavigationViewItem`


## PR Checklist

Please check if your PR fulfills the following requirements:

- [ ] Tested code with current [supported SDKs](../readme.md#supported)
- [ ] Tests for the changes have been added (for bug fixes / features) (if applicable)
- [x] Contains **NO** breaking changes
@ghost ghost added Completed 🔥 and removed In-PR 🚀 labels Jul 30, 2021
@nlogozzo
Copy link
Author

When can we see this fix in an update?

@yoshiask
Copy link
Contributor

According to the 7.1 milestone, "mid-2021ish"

@michael-hawker
Copy link
Member

Since we updated to the latest WinUI 2.6 styles at the same time, we're waiting for WinUI 3 support for WinUI 2.6 styles before we can ship an update including this fix. Worst case they only ship the updated styles for WinUI 3 when they ship 1.0 later this year, but hopefully one of their next previews would contain them instead.

@ghost ghost locked as resolved and limited conversation to collaborators Nov 3, 2021
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior Completed 🔥 sdkcheck 🏁
Projects
No open projects
3 participants