-
Notifications
You must be signed in to change notification settings - Fork 156
Create TabbedCommandBar.md #405
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
Closed
Closed
Changes from 6 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
51bb022
Create TabbedCommandBar.md
yoshiask 6552f78
Added TabbedCommandBar to ToC
yoshiask 80ecc82
Fixed links at end of doc
yoshiask 9ec3514
Update "Syntax" section with code from SampleApp
yoshiask 8f018ab
Updated properties; Added few examples
yoshiask ac7538b
Added overview GIF
yoshiask a63a266
Merge branch 'master' into patch-1
Kyaa-dost 6a83ab2
Update docs/controls/TabbedCommandBar.md
michael-hawker b9b0b35
Apply suggestions from code review
michael-hawker a2e64c3
Merge branch 'master' into patch-1
michael-hawker 1f71dbc
Update toc.md
Kyaa-dost fa67ea4
Updated contextual tab example; Switched from GIF to PNG for overview
yoshiask fdd0679
Use `https`
yoshiask d6eefb4
Satisfy linter
yoshiask File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,248 @@ | ||
--- | ||
title: TabbedCommandBar XAML Control | ||
author: yoshiask | ||
description: TabbedCommandBar is a control for displaying multiple CommandBars in the same space, like Microsoft Office's ribbon. | ||
keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, TabbedCommandBar, CommandBar, ribbon | ||
dev_langs: | ||
- csharp | ||
--- | ||
|
||
# TabbedCommandBar XAML Control | ||
The [TabbedCommandBar](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.tabbedcommandbar) displays a set of [TabbedCommandBarItem](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.tabbedcommandbaritem) in a shared container, like Microsoft Office's ribbon. | ||
|
||
> [!div class="nextstepaction"] | ||
> [Try it in the sample app](uwpct://Controls?sample=TabbedCommandBar) | ||
|
||
## Remarks | ||
The TabbedCommandBar automatically applies styles to known common controls inside an `AppBarElementContainer`. The following elements have styles: | ||
- ComboBox | ||
- SplitButton | ||
|
||
> [!NOTE] | ||
> The ComboBox does not allow changing its selection while it is in the overflow flyout. | ||
|
||
## Syntax | ||
|
||
```xaml | ||
<controls:TabbedCommandBar> | ||
<controls:TabbedCommandBar.PaneFooter> | ||
<CommandBar Background="Transparent" DefaultLabelPosition="Right"> | ||
<AppBarButton Label="Share" Icon="Share"/> | ||
<AppBarButton Label="Comments" Icon="Message"/> | ||
</CommandBar> | ||
</controls:TabbedCommandBar.PaneFooter> | ||
<controls:TabbedCommandBar.MenuItems> | ||
<controls:TabbedCommandBarItem Header="Home"> | ||
<AppBarButton Icon="Undo" Label="Undo"/> | ||
<AppBarButton Icon="Redo" Label="Redo"/> | ||
<AppBarButton Icon="Paste" Label="Paste"/> | ||
<AppBarSeparator /> | ||
<AppBarElementContainer> | ||
<SplitButton> | ||
<FontIcon FontFamily="{ThemeResource SymbolThemeFontFamily}" Glyph="" /> | ||
<SplitButton.Flyout> | ||
<Flyout> | ||
<controls:ColorPicker Margin="-10" Color="{ThemeResource Brand-Color}"/> | ||
</Flyout> | ||
</SplitButton.Flyout> | ||
</SplitButton> | ||
</AppBarElementContainer> | ||
<AppBarElementContainer> | ||
<ComboBox SelectedIndex="0" MinWidth="175"> | ||
<ComboBoxItem Content="Arial" /> | ||
<ComboBoxItem Content="Calibri" /> | ||
<ComboBoxItem Content="JetBrains Mono" /> | ||
<ComboBoxItem Content="Roboto" /> | ||
<ComboBoxItem Content="Sergio UI" /> | ||
<ComboBoxItem Content="Sergio UI Semibold" /> | ||
</ComboBox> | ||
</AppBarElementContainer> | ||
<AppBarElementContainer> | ||
<TextBox PlaceholderText="Size"/> | ||
</AppBarElementContainer> | ||
<AppBarToggleButton Icon="Bold" Label="Bold" /> | ||
<AppBarToggleButton Icon="Italic" Label="Italic" /> | ||
<AppBarToggleButton Icon="Underline" Label="Underline" /> | ||
</controls:TabbedCommandBarItem> | ||
<controls:TabbedCommandBarItem Header="Insert"> | ||
<AppBarButton Icon="Pictures" Label="Pictures"> | ||
<AppBarButton.Flyout> | ||
<MenuFlyout Placement="BottomEdgeAlignedLeft"> | ||
<MenuFlyoutItem Text="This Device"> | ||
<MenuFlyoutItem.Icon> | ||
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" /> | ||
</MenuFlyoutItem.Icon> | ||
</MenuFlyoutItem> | ||
<MenuFlyoutItem Text="Stock Images"> | ||
<MenuFlyoutItem.Icon> | ||
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" /> | ||
</MenuFlyoutItem.Icon> | ||
</MenuFlyoutItem> | ||
<MenuFlyoutItem Icon="Globe" Text="Online Pictures" /> | ||
</MenuFlyout> | ||
</AppBarButton.Flyout> | ||
</AppBarButton> | ||
<AppBarButton Label="Shapes"> | ||
<AppBarButton.Icon> | ||
<FontIcon FontFamily="Segoe UI Symbol" Glyph="□" /> | ||
</AppBarButton.Icon> | ||
</AppBarButton> | ||
<AppBarButton Label="Icons"> | ||
<AppBarButton.Icon> | ||
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" /> | ||
</AppBarButton.Icon> | ||
</AppBarButton> | ||
<AppBarButton Label="3D Models"> | ||
<AppBarButton.Icon> | ||
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" /> | ||
</AppBarButton.Icon> | ||
</AppBarButton> | ||
<AppBarSeparator/> | ||
<AppBarButton Label="Add-ins"> | ||
<AppBarButton.Icon> | ||
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" /> | ||
</AppBarButton.Icon> | ||
</AppBarButton> | ||
<controls:TabbedCommandBarItem.SecondaryCommands> | ||
<AppBarButton Icon="Add" Label="New item" /> | ||
</controls:TabbedCommandBarItem.SecondaryCommands> | ||
</controls:TabbedCommandBarItem> | ||
<controls:TabbedCommandBarItem Header="Shape Format" IsContextual="True" Visibility="{Binding ElementName=ContextualToggle, Path=IsOn}"> | ||
<AppBarButton Label="Shape Fill"> | ||
<AppBarButton.Icon> | ||
<FontIcon FontFamily="{ThemeResource SymbolThemeFontFamily}" Glyph="" /> | ||
</AppBarButton.Icon> | ||
</AppBarButton> | ||
<AppBarButton Label="Shape Outline"> | ||
<AppBarButton.Icon> | ||
<FontIcon FontFamily="{ThemeResource SymbolThemeFontFamily}" Glyph="" /> | ||
</AppBarButton.Icon> | ||
</AppBarButton> | ||
</controls:TabbedCommandBarItem> | ||
</controls:TabbedCommandBar.MenuItems> | ||
</controls:TabbedCommandBar> | ||
``` | ||
|
||
## Sample Output | ||
|
||
 | ||
|
||
## Properties | ||
|
||
### TabbedCommandBar Properties | ||
|
||
The TabbedCommandBar does not add any of its own properties. See [NavigationView](https://docs.microsoft.com/uwp/api/windows.ui.xaml.controls.navigationview#properties) for a list of accessible properties. | ||
|
||
> [!IMPORTANT] | ||
> Do not use `ItemsStackPanel` if you override the ItemsPanel. It is suggested to keep the `TabWidthBehavior` to `Actual` when using a custom panel. | ||
yoshiask marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### TabbedCommandBarItem Properties | ||
|
||
| Property | Type | Description | | ||
| -- | -- | -- | | ||
| Header | object | Header Content of the Tab. | | ||
| IsContextual | bool | Set to true for the TabbedCommandBarItem to be styled as a contextual Tab. | | ||
| OverflowButtonAlignment | HorizontalAlignment | Indicates the alignment of the command overflow button. | | ||
| CommandAlignment | HorizontalAlignment | Indicates the alignment of this Tab's commands. | | ||
|
||
## Events | ||
|
||
### TabbedCommandBar Events | ||
|
||
| Events | Description | | ||
| -- | -- | | ||
| SelectionChanged | Fires when a different Tab is selected. | | ||
|
||
## Examples | ||
|
||
The following setup demos contextual tabs, and binding to their visibility: | ||
|
||
```xaml | ||
<controls:TabbedCommandBar> | ||
<controls:TabbedCommandBar.MenuItems> | ||
<controls:TabbedCommandBarItem Header="Home"> | ||
<AppBarButton Icon="Undo" Label="Undo"/> | ||
<AppBarButton Icon="Redo" Label="Redo"/> | ||
<AppBarButton Icon="Paste" Label="Paste"/> | ||
</controls:TabbedCommandBarItem> | ||
<controls:TabbedCommandBarItem Header="View" IsContextual="True" Visibility="{Binding ElementName=ContextualToggle, Path=IsOn}"> | ||
yoshiask marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<AppBarButton Label="Left" Icon="DockLeft"/> | ||
<AppBarButton Label="Right" Icon="DockRight"/> | ||
<AppBarButton Label="Bottom" Icon="DockBottom"/> | ||
</controls:TabbedCommandBarItem> | ||
</controls:TabbedCommandBar.MenuItems> | ||
</controls:TabbedCommandBar> | ||
|
||
... | ||
|
||
<ToggleSwitch x:Name="ContextualToggle" IsOn="True" | ||
OffContent="Contextual Tab Off" | ||
OnContent="Contextual Tab On"/> | ||
``` | ||
|
||
`ComboBox`, `TextBox`, and `SplitButton` do not have "AppBar" variants. Below is how to use those controls in a `TabbedCommandBarItem`: | ||
|
||
```xaml | ||
<controls:TabbedCommandBar> | ||
<controls:TabbedCommandBar.MenuItems> | ||
<controls:TabbedCommandBarItem Header="Home"> | ||
|
||
<!-- SplitButton --> | ||
<AppBarElementContainer> | ||
<SplitButton> | ||
<FontIcon Glyph="" FontSize="18" /> | ||
<SplitButton.Flyout> | ||
<Flyout> | ||
<controls:ColorPicker Margin="-10" Color="{ThemeResource Brand-Color}"/> | ||
</Flyout> | ||
</SplitButton.Flyout> | ||
</SplitButton> | ||
</AppBarElementContainer> | ||
|
||
<!-- ComboBox --> | ||
<AppBarElementContainer> | ||
<ComboBox SelectedIndex="0" MinWidth="175"> | ||
<ComboBoxItem Content="Arial" /> | ||
<ComboBoxItem Content="Calibri" /> | ||
<ComboBoxItem Content="JetBrains Mono" /> | ||
<ComboBoxItem Content="Roboto" /> | ||
<ComboBoxItem Content="Sergio UI" /> | ||
<ComboBoxItem Content="Sergio UI Semibold" /> | ||
</ComboBox> | ||
</AppBarElementContainer> | ||
|
||
<!-- TextBox --> | ||
<AppBarElementContainer> | ||
<TextBox PlaceholderText="Size"/> | ||
</AppBarElementContainer> | ||
|
||
</controls:TabbedCommandBarItem> | ||
</controls:TabbedCommandBar.MenuItems> | ||
</controls:TabbedCommandBar> | ||
``` | ||
|
||
## Sample Project | ||
|
||
[TabbedCommandBar Sample Page Source](https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TabbedCommandBar). You can [see this in action](uwpct://Controls?sample=TabbedCommandBar) in the [Windows Community Toolkit Sample App](http://aka.ms/uwptoolkitapp). | ||
|
||
## Default Template | ||
|
||
[TabbedCommandBar XAML File](https://github.com/windows-toolkit/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBar.xaml) is the XAML template used in the toolkit for the default styling. | ||
|
||
## Requirements | ||
|
||
| Device family | Universal, 10.0.16299.0 or higher | | ||
michael-hawker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| -- | -- | | ||
| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | | ||
| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | | ||
|
||
## API | ||
|
||
- [TabbedCommandBar source code](https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar) | ||
michael-hawker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Related Topics | ||
|
||
- [ObservableCollection](https://docs.microsoft.com/dotnet/api/system.collections.objectmodel.observablecollection-1) | ||
- [NavigationView](https://docs.microsoft.com/uwp/api/Windows.UI.Xaml.Controls.NavigationView) | ||
- [AppBarElementContainer](https://docs.microsoft.com/uwp/api/Windows.UI.Xaml.Controls.AppBarElementContainer) | ||
- [Ribbon (WPF)](https://docs.microsoft.com/dotnet/api/system.windows.controls.ribbon.ribbon) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.