Skip to content

Conversation

@yoshiask
Copy link
Contributor

@yoshiask yoshiask commented Nov 2, 2020

Moved to #3556

Fixes

#3259

PR Type

What kind of change does this PR introduce?

Feature

Sample app changes

What is the current behavior?

There is no ribbon or ribbon-like control for UWP. The current solution is to put CommandBars inside of a Pivot.

What is the new behavior?

Adds a TabbedCommandBar, which internally is almost identical to the current solutions, but provides a much friendlier developer experience.

PR Checklist

Please check if your PR fulfills the following requirements:

Other information

@ghost
Copy link

ghost commented Nov 2, 2020

Thanks yoshiask for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌

@ghost ghost requested review from Kyaa-dost, azchohfi and michael-hawker November 2, 2020 21:59
@net-foundation-cla
Copy link

net-foundation-cla bot commented Nov 2, 2020

CLA assistant check
All CLA requirements met.

@mdtauk
Copy link

mdtauk commented Nov 3, 2020

I am very happy with the name TabbedCommandBar - I would be happy if this control and name could make it's way to WinUI proper in the future.

yoshiask added a commit to yoshiask/WindowsCommunityToolkitDocs that referenced this pull request Nov 3, 2020
Started writing the documentation for [TabbedCommandBar](CommunityToolkit/WindowsCommunityToolkit#3551)
Copy link
Member

@michael-hawker michael-hawker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a quick review, will need to try out a bit more, but some general feedback on a couple of things to clean-up (like massive commented xaml sections?).

For the sample app control image, I was wondering if there should be the three white dots that represent the commandbar in the second row:

image

{42CA4935-54BE-42EA-AC19-992378C08DE6}.Release|x64.Build.0 = Release|Any CPU
{42CA4935-54BE-42EA-AC19-992378C08DE6}.Release|x86.ActiveCfg = Release|Any CPU
{42CA4935-54BE-42EA-AC19-992378C08DE6}.Release|x86.Build.0 = Release|Any CPU
{A5E98964-45B1-442D-A07A-298A3221D81E}.Debug|Any CPU.ActiveCfg = Debug|Win32
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea what these represent and why there are removed?

<PopInThemeAnimation TargetName="PART_RibbonContent" />
</Storyboard>
<Style TargetType="ComboBox" />
<!--<Style TargetType="ComboBox">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to keep these big comment blocks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for this one (the ComboBox style) is because there's currently a bug that causes an unhandled native exception in WUX when the ComboBox style is overridden here. I've yet to make a minimum repo for it. Anyway, that style is supposed to make ComboBoxes look presentable in the primary commands space and also play nicely with overflow (because ATM they're completely unusable once they get put into the overflow menu).

Presumably that style should be placed in its own file and given a key (like ComboBoxAppBarStyle)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I don't want to make too many changes to the ComboBox style. Is there any way to change parts of the template while leaving other parts of it as the default, or do I have to retemplate the entire control?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yoshiask not with ComboBox as it doesn't expose it's template as a key we can reference link you could with CommandBarRevealStyle. If it did and you were only adjusting properties, you could just modify the setters without the template....

Agree we should try and stick it in it's own file and then just merge in with the resource dictionary here.

<!-- For some reason this code causes an exception at runtime, that String couldn't be turned into a Uri. -->
<!--<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///Microsoft.Toolkit.Uwp.UI.Controls.Ribbon/TabbedCommandBar/TabbedCommandBar.xaml" />
<ResourceDictionary Source="ms-appx:///Microsoft.Toolkit.Uwp.UI.Controls.Ribbon/TabbedCommandBar/TabbedCommandBarItem.xaml" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have the Item style in it's own XAML file and merge it in here (see what we did for the Tokenizing Text Box).

Comment on lines +74 to +76
<Page Update="Ribbon\Ribbon.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<Page Update="Ribbon\Ribbon.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>

This looks extra?

using Microsoft.Windows.Design.PropertyEditing;
using System.ComponentModel;

namespace Microsoft.Toolkit.Uwp.UI.Controls.Design
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're moving to the new format in #3318. I don't think there's a way for you to pre-emptively move there though until that's merged.

@Nirmal4G correct?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@ghost
Copy link

ghost commented Nov 3, 2020

This PR has been marked as "needs attention 👋" and awaiting a response from the team.

@michael-hawker
Copy link
Member

Few more comments.

Where is 'Test' coming from??? (I can't find it.)

image

For the secondary commands:

image

Can we request the dropdown placement to go down vs. up?

Also, is it easy to provide an option for the '...' to be either right-aligned to the panel like it is now OR to be next to the last item in the list if there's not enough to fill it?

Have a few more inline code comments. It definitely looks like something is holding a reference to the items and not letting them go. I wonder if it has something to do with NavigationView itself as we aren't using NavigationViewItem directly? I was able to bind to MenuItemsSource directly and that exposed the problem a bit more clearly.

@ghost ghost removed the needs attention 👋 label Nov 3, 2020
Copy link
Member

@michael-hawker michael-hawker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to submit my comments. 🤦‍♂️

<ResourceDictionary Source="ms-appx:///Microsoft.Toolkit.Uwp.UI.Controls.Ribbon/TabbedCommandBar/TabbedCommandBarItem.xaml" />
</ResourceDictionary.MergedDictionaries>-->

<Style BasedOn="{StaticResource CommandBarRevealStyle}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm going to say we should split this in the file and instead of referencing the template, copy it. As then we can expose the properties for configuring where the 'More' button is aligned, and then we won't be trying to grab them in the OnApplyTemplate to set properties in code-behind.

<PopInThemeAnimation TargetName="PART_RibbonContent" />
</Storyboard>
<Style TargetType="ComboBox" />
<!--<Style TargetType="ComboBox">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yoshiask not with ComboBox as it doesn't expose it's template as a key we can reference link you could with CommandBarRevealStyle. If it did and you were only adjusting properties, you could just modify the setters without the template....

Agree we should try and stick it in it's own file and then just merge in with the resource dictionary here.

</NavigationViewItem.Resources>
</NavigationViewItem>
</DataTemplate>
<controls:TabbedCommandBarItemTemplateSelector x:Key="DefaultTabbedCommandBarItemTemplateSelector"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we want to be using a container style selector vs a template one? Though I didn't see it duplicating NavigationViewItems so that was good. Not sure how easy it'd be to do the resource overrides like you're doing with a style selector vs. a template selector.

We should probably expose all these outside the Grid so that developers can override them, it's just going to be easier to expose them as Styles vs. DataTemplates for what developers are used to. (Like they'd probably expect them as style properties on the TabbedCommandBar to be able to override with their own style.)

Comment on lines +15 to +18
<controls:TabbedCommandBar.Resources>
<StaticResource x:Key="NavigationViewTopPaneBackground" ResourceKey="SystemControlChromeMediumLowAcrylicWindowMediumBrush" />
<StaticResource x:Key="TabbedCommandBarContentBackground" ResourceKey="SystemControlChromeLowAcrylicWindowBrush" />
</controls:TabbedCommandBar.Resources>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't notice a big difference without these resources? We should just have the example be as default as possible.

@michael-hawker
Copy link
Member

Closing this now that #3556 is open.

@yoshiask
Copy link
Contributor Author

yoshiask commented Nov 6, 2020

Dang that was quick 😆

ghost pushed a commit that referenced this pull request Feb 10, 2021
<!-- 🚨 Please Do Not skip any instructions and information mentioned below as they are all required and essential to evaluate and test the PR. By fulfilling all the required information you will be able to reduce the volume of questions and most likely help merge the PR faster 🚨 -->

## Fixes #3259
<!-- Add the relevant issue number after the "#" mentioned above (for ex: Fixes #1234) which will automatically close the issue once the PR is merged. -->


<!-- Add a brief overview here of the feature/bug & fix. -->

## PR Type
What kind of change does this PR introduce?
<!-- Please uncomment one or more that apply to this PR. -->

<!-- - Bugfix -->
Feature
<!-- - Code style update (formatting) -->
<!-- - Refactoring (no functional changes, no api changes) -->
<!-- - Build or CI related changes -->
<!-- - Documentation content changes -->
Sample app changes
<!-- - Other... Please describe: -->


## What is the current behavior?
There is no ribbon or ribbon-like control for UWP. The current solution is to put CommandBars inside of a Pivot.

## What is the new behavior?
Adds a TabbedCommandBar, which internally is almost identical to the current solutions, but provides a much friendlier developer experience.


## PR Checklist

Please check if your PR fulfills the following requirements:

- [ ] Tested code with current [supported SDKs](../readme.md#supported)
- [ ] Pull Request has been submitted to the documentation repository [instructions](..\contributing.md#docs). Link: MicrosoftDocs/WindowsCommunityToolkitDocs#405
- [ ] Sample in sample app has been added / updated (for bug fixes / features)
    - [x] Icon has been created (if new sample) following the [Thumbnail Style Guide and templates](https://github.com/windows-toolkit/WindowsCommunityToolkit-design-assets)
- [ ] Tests for the changes have been added (for bug fixes / features) (if applicable)
- [ ] Header has been added to all new source files (run *build/UpdateHeaders.bat*)
- [x] Contains **NO** breaking changes

<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. 
     Please note that breaking changes are likely to be rejected within minor release cycles or held until major versions. -->


## Other information
I forgot to do my work on a feature branch, so this PR is basically a duplicate of #3551, with a little bit of cleanup.
michael-hawker pushed a commit to michael-hawker/WindowsCommunityToolkitDocs that referenced this pull request Mar 9, 2021
Started writing the documentation for [TabbedCommandBar](CommunityToolkit/WindowsCommunityToolkit#3551)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants