From 255eee88afda481bc32eedd87c1543ed558579e8 Mon Sep 17 00:00:00 2001 From: YoshiAsk Date: Mon, 2 Nov 2020 14:50:39 -0600 Subject: [PATCH 1/5] Add initial work for TabbedCommandBar --- .../Microsoft.Toolkit.Uwp.UI.Controls.csproj | 3 + .../TabbedCommandBar/TabbedCommandBar.cs | 117 +++++ .../TabbedCommandBar/TabbedCommandBar.xaml | 443 ++++++++++++++++++ .../TabbedCommandBar/TabbedCommandBarItem.cs | 100 ++++ .../TabbedCommandBarItemTemplateSelector.cs | 37 ++ .../Themes/Generic.xaml | 1 + .../VisualStudioToolsManifest.xml | 1 + Windows Community Toolkit.sln | 43 -- 8 files changed, 702 insertions(+), 43 deletions(-) create mode 100644 Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBar.cs create mode 100644 Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBar.xaml create mode 100644 Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBarItem.cs create mode 100644 Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBarItemTemplateSelector.cs diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/Microsoft.Toolkit.Uwp.UI.Controls.csproj b/Microsoft.Toolkit.Uwp.UI.Controls/Microsoft.Toolkit.Uwp.UI.Controls.csproj index 6258250a2f0..e66525ff1e6 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/Microsoft.Toolkit.Uwp.UI.Controls.csproj +++ b/Microsoft.Toolkit.Uwp.UI.Controls/Microsoft.Toolkit.Uwp.UI.Controls.csproj @@ -71,6 +71,9 @@ Designer + + MSBuild:Compile + MSBuild:Compile diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBar.cs b/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBar.cs new file mode 100644 index 00000000000..a1284f4ea78 --- /dev/null +++ b/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBar.cs @@ -0,0 +1,117 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Linq; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Markup; +using Windows.UI.Xaml.Media.Animation; + +namespace Microsoft.Toolkit.Uwp.UI.Controls +{ + /// + /// A basic ribbon control that houses s + /// + [ContentProperty(Name = nameof(Items))] + [TemplatePart(Name = "PART_RibbonNavigationView", Type = typeof(NavigationView))] + [TemplatePart(Name = "PART_RibbonContent", Type = typeof(ContentControl))] + [TemplatePart(Name = "PART_TabChangedStoryboard", Type = typeof(Storyboard))] + public class TabbedCommandBar : Control + { + private NavigationView _ribbonNavigationView = null; + private ContentControl _ribbonContent = null; + private Storyboard _tabChangedStoryboard = null; + + // This should probably be made public at some point + private TabbedCommandBarItem SelectedTab { get; set; } + + /// + /// Identifies the property. + /// + public static readonly DependencyProperty ItemsProperty = DependencyProperty.Register( + nameof(Items), + typeof(IList), + typeof(TabbedCommandBar), + new PropertyMetadata(new List())); + + /// + /// Identifies the property. + /// + public static readonly DependencyProperty FooterProperty = DependencyProperty.Register( + nameof(Footer), + typeof(UIElement), + typeof(TabbedCommandBar), + new PropertyMetadata(new Border())); + + // I would prefer this be an IList, but Intellisense really doesn't like that. + /// + /// Gets or sets A list of s to display in this . + /// + public IList Items + { + get { return (IList)GetValue(ItemsProperty); } + set { SetValue(ItemsProperty, value); } + } + + /// + /// Gets or sets the to be displayed in the footer of the ribbon tab strip. + /// + public UIElement Footer + { + get { return (UIElement)GetValue(FooterProperty); } + set { SetValue(FooterProperty, value); } + } + + /// + /// Initializes a new instance of the class. + /// + public TabbedCommandBar() + { + DefaultStyleKey = typeof(TabbedCommandBar); + } + + /// + protected override void OnApplyTemplate() + { + base.OnApplyTemplate(); + + // Get RibbonContent first, since setting SelectedItem requires it + _ribbonContent = GetTemplateChild("PART_RibbonContent") as ContentControl; + + _ribbonNavigationView = GetTemplateChild("PART_RibbonNavigationView") as NavigationView; + if (_ribbonNavigationView != null) + { + // Populate the NavigationView with items + // TODO: Get binding working, necessary for contextual tabs + _ribbonNavigationView.MenuItems.Clear(); + foreach (TabbedCommandBarItem item in Items) + { + _ribbonNavigationView.MenuItems.Add(item); + } + _ribbonNavigationView.PaneFooter = Footer; + + _ribbonNavigationView.SelectionChanged += RibbonNavigationView_SelectionChanged; + _ribbonNavigationView.SelectedItem = _ribbonNavigationView.MenuItems.FirstOrDefault(); + } + + _tabChangedStoryboard = GetTemplateChild(nameof(_tabChangedStoryboard)) as Storyboard; + } + + private void RibbonNavigationView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args) + { + if (args.SelectedItem is TabbedCommandBarItem item) + { + _ribbonContent.Content = item; + _tabChangedStoryboard?.Begin(); + } + else if (args.SelectedItem is NavigationViewItem navItem) + { + // This code is a hack and is only temporary, because I can't get binding to work. + // RibbonContent might be null here, there should be a check + _ribbonContent.Content = Items[System.Math.Min(Items.Count - 1, _ribbonNavigationView.MenuItems.IndexOf(navItem))]; + } + } + } +} \ No newline at end of file diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBar.xaml b/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBar.xaml new file mode 100644 index 00000000000..75732830e3a --- /dev/null +++ b/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBar.xaml @@ -0,0 +1,443 @@ + + + + + + + + + --> + + + + + + + + + diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBarItem.cs b/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBarItem.cs new file mode 100644 index 00000000000..5dc727a0453 --- /dev/null +++ b/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBarItem.cs @@ -0,0 +1,100 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; + +namespace Microsoft.Toolkit.Uwp.UI.Controls +{ + /// + /// A to be displayed in a + /// + [TemplatePart(Name = "PrimaryItemsControl", Type = typeof(ItemsControl))] + [TemplatePart(Name = "MoreButton", Type = typeof(Button))] + public class TabbedCommandBarItem : CommandBar + { + private ItemsControl _primaryItemsControl; + private Button _moreButton; + + /// + /// Initializes a new instance of the class. + /// + public TabbedCommandBarItem() + { + DefaultStyleKey = typeof(TabbedCommandBarItem); + } + + /// + /// Identifies the property. + /// + public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register( + nameof(Header), + typeof(string), + typeof(TabbedCommandBarItem), + new PropertyMetadata(string.Empty)); + + /// + /// Gets or sets the title of this ribbon tab. + /// + public string Header + { + get => (string)GetValue(HeaderProperty); + set => SetValue(HeaderProperty, value); + } + + /// + /// Identifies the property. + /// + public static readonly DependencyProperty FooterProperty = DependencyProperty.Register( + nameof(Footer), + typeof(UIElement), + typeof(TabbedCommandBarItem), + new PropertyMetadata(new Border())); + + /// + /// Identifies the property. + /// + public static readonly DependencyProperty IsContextualProperty = DependencyProperty.Register( + nameof(IsContextual), + typeof(bool), + typeof(TabbedCommandBarItem), + new PropertyMetadata(false)); + + /// + /// Gets or sets the to be displayed in the footer of the tab. + /// + public UIElement Footer + { + get => (UIElement)GetValue(FooterProperty); + set => SetValue(FooterProperty, value); + } + + /// + /// Gets or sets a value indicating whether this tab is contextual. + /// + public bool IsContextual + { + get => (bool)GetValue(IsContextualProperty); + set => SetValue(IsContextualProperty, value); + } + + /// + protected override void OnApplyTemplate() + { + base.OnApplyTemplate(); + + _primaryItemsControl = GetTemplateChild("PrimaryItemsControl") as ItemsControl; + if (_primaryItemsControl != null) + { + _primaryItemsControl.HorizontalAlignment = HorizontalAlignment.Left; + } + + _moreButton = GetTemplateChild("MoreButton") as Button; + if (_moreButton != null) + { + _moreButton.HorizontalAlignment = HorizontalAlignment.Right; + } + } + } +} \ No newline at end of file diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBarItemTemplateSelector.cs b/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBarItemTemplateSelector.cs new file mode 100644 index 00000000000..06712d3c65b --- /dev/null +++ b/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBarItemTemplateSelector.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; + +namespace Microsoft.Toolkit.Uwp.UI.Controls +{ + /// + /// used by for determining the style of normal vs. contextual s. + /// + public class TabbedCommandBarItemTemplateSelector : DataTemplateSelector + { + /// + /// Gets or sets the of a normal . + /// + public DataTemplate Normal { get; set; } + + /// + /// Gets or sets the of a contextual . + /// + public DataTemplate Contextual { get; set; } + + /// + protected override DataTemplate SelectTemplateCore(object item) + { + return ((TabbedCommandBarItem)item).IsContextual ? Contextual : Normal; + } + + /// + protected override DataTemplate SelectTemplateCore(object item, DependencyObject container) + { + return SelectTemplateCore(item); + } + } +} \ No newline at end of file diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/Themes/Generic.xaml b/Microsoft.Toolkit.Uwp.UI.Controls/Themes/Generic.xaml index 8354174809c..e30898a6a9f 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/Themes/Generic.xaml +++ b/Microsoft.Toolkit.Uwp.UI.Controls/Themes/Generic.xaml @@ -29,6 +29,7 @@ + diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/VisualStudioToolsManifest.xml b/Microsoft.Toolkit.Uwp.UI.Controls/VisualStudioToolsManifest.xml index b952e2ec958..479fe150be9 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/VisualStudioToolsManifest.xml +++ b/Microsoft.Toolkit.Uwp.UI.Controls/VisualStudioToolsManifest.xml @@ -31,6 +31,7 @@ + diff --git a/Windows Community Toolkit.sln b/Windows Community Toolkit.sln index dbb8ef27886..cd5dc10041a 100644 --- a/Windows Community Toolkit.sln +++ b/Windows Community Toolkit.sln @@ -569,34 +569,6 @@ Global {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 - {A5E98964-45B1-442D-A07A-298A3221D81E}.Debug|Any CPU.Build.0 = Debug|Win32 - {A5E98964-45B1-442D-A07A-298A3221D81E}.Debug|ARM.ActiveCfg = Debug|ARM - {A5E98964-45B1-442D-A07A-298A3221D81E}.Debug|ARM.Build.0 = Debug|ARM - {A5E98964-45B1-442D-A07A-298A3221D81E}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {A5E98964-45B1-442D-A07A-298A3221D81E}.Debug|ARM64.Build.0 = Debug|ARM64 - {A5E98964-45B1-442D-A07A-298A3221D81E}.Debug|x64.ActiveCfg = Debug|x64 - {A5E98964-45B1-442D-A07A-298A3221D81E}.Debug|x64.Build.0 = Debug|x64 - {A5E98964-45B1-442D-A07A-298A3221D81E}.Debug|x86.ActiveCfg = Debug|Win32 - {A5E98964-45B1-442D-A07A-298A3221D81E}.Debug|x86.Build.0 = Debug|Win32 - {A5E98964-45B1-442D-A07A-298A3221D81E}.Native|Any CPU.ActiveCfg = Release|Win32 - {A5E98964-45B1-442D-A07A-298A3221D81E}.Native|ARM.ActiveCfg = Release|ARM - {A5E98964-45B1-442D-A07A-298A3221D81E}.Native|ARM.Build.0 = Release|ARM - {A5E98964-45B1-442D-A07A-298A3221D81E}.Native|ARM64.ActiveCfg = Release|ARM64 - {A5E98964-45B1-442D-A07A-298A3221D81E}.Native|ARM64.Build.0 = Release|ARM64 - {A5E98964-45B1-442D-A07A-298A3221D81E}.Native|x64.ActiveCfg = Release|x64 - {A5E98964-45B1-442D-A07A-298A3221D81E}.Native|x64.Build.0 = Release|x64 - {A5E98964-45B1-442D-A07A-298A3221D81E}.Native|x86.ActiveCfg = Release|Win32 - {A5E98964-45B1-442D-A07A-298A3221D81E}.Native|x86.Build.0 = Release|Win32 - {A5E98964-45B1-442D-A07A-298A3221D81E}.Release|Any CPU.ActiveCfg = Release|Win32 - {A5E98964-45B1-442D-A07A-298A3221D81E}.Release|ARM.ActiveCfg = Release|ARM - {A5E98964-45B1-442D-A07A-298A3221D81E}.Release|ARM.Build.0 = Release|ARM - {A5E98964-45B1-442D-A07A-298A3221D81E}.Release|ARM64.ActiveCfg = Release|ARM64 - {A5E98964-45B1-442D-A07A-298A3221D81E}.Release|ARM64.Build.0 = Release|ARM64 - {A5E98964-45B1-442D-A07A-298A3221D81E}.Release|x64.ActiveCfg = Release|x64 - {A5E98964-45B1-442D-A07A-298A3221D81E}.Release|x64.Build.0 = Release|x64 - {A5E98964-45B1-442D-A07A-298A3221D81E}.Release|x86.ActiveCfg = Release|Win32 - {A5E98964-45B1-442D-A07A-298A3221D81E}.Release|x86.Build.0 = Release|Win32 {5BF75694-798A-43A0-8150-415DE195359C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5BF75694-798A-43A0-8150-415DE195359C}.Debug|Any CPU.Build.0 = Debug|Any CPU {5BF75694-798A-43A0-8150-415DE195359C}.Debug|ARM.ActiveCfg = Debug|Any CPU @@ -904,11 +876,6 @@ Global {05C83067-FA46-45E2-BEC4-EDEE84AD18D0}.Debug|x86.ActiveCfg = Debug|x86 {05C83067-FA46-45E2-BEC4-EDEE84AD18D0}.Debug|x86.Build.0 = Debug|x86 {05C83067-FA46-45E2-BEC4-EDEE84AD18D0}.Debug|x86.Deploy.0 = Debug|x86 - {05C83067-FA46-45E2-BEC4-EDEE84AD18D0}.Native|Any CPU.ActiveCfg = Release|x64 - {05C83067-FA46-45E2-BEC4-EDEE84AD18D0}.Native|ARM.ActiveCfg = Release|ARM - {05C83067-FA46-45E2-BEC4-EDEE84AD18D0}.Native|ARM64.ActiveCfg = Release|ARM64 - {05C83067-FA46-45E2-BEC4-EDEE84AD18D0}.Native|x64.ActiveCfg = Release|x64 - {05C83067-FA46-45E2-BEC4-EDEE84AD18D0}.Native|x86.ActiveCfg = Release|x86 {05C83067-FA46-45E2-BEC4-EDEE84AD18D0}.Release|Any CPU.ActiveCfg = Release|x86 {05C83067-FA46-45E2-BEC4-EDEE84AD18D0}.Release|Any CPU.Build.0 = Release|x86 {05C83067-FA46-45E2-BEC4-EDEE84AD18D0}.Release|ARM.ActiveCfg = Release|ARM @@ -933,11 +900,6 @@ Global {5F720475-E263-4A5A-8C88-2B805B45B5BC}.Debug|x64.Build.0 = Debug|Any CPU {5F720475-E263-4A5A-8C88-2B805B45B5BC}.Debug|x86.ActiveCfg = Debug|Any CPU {5F720475-E263-4A5A-8C88-2B805B45B5BC}.Debug|x86.Build.0 = Debug|Any CPU - {5F720475-E263-4A5A-8C88-2B805B45B5BC}.Native|Any CPU.ActiveCfg = Debug|Any CPU - {5F720475-E263-4A5A-8C88-2B805B45B5BC}.Native|ARM.ActiveCfg = Debug|Any CPU - {5F720475-E263-4A5A-8C88-2B805B45B5BC}.Native|ARM64.ActiveCfg = Debug|Any CPU - {5F720475-E263-4A5A-8C88-2B805B45B5BC}.Native|x64.ActiveCfg = Debug|Any CPU - {5F720475-E263-4A5A-8C88-2B805B45B5BC}.Native|x86.ActiveCfg = Debug|Any CPU {5F720475-E263-4A5A-8C88-2B805B45B5BC}.Release|Any CPU.ActiveCfg = Release|Any CPU {5F720475-E263-4A5A-8C88-2B805B45B5BC}.Release|Any CPU.Build.0 = Release|Any CPU {5F720475-E263-4A5A-8C88-2B805B45B5BC}.Release|ARM.ActiveCfg = Release|Any CPU @@ -958,11 +920,6 @@ Global {C8182EF0-77FB-4B43-A588-C71748A309C7}.Debug|x64.Build.0 = Debug|Any CPU {C8182EF0-77FB-4B43-A588-C71748A309C7}.Debug|x86.ActiveCfg = Debug|Any CPU {C8182EF0-77FB-4B43-A588-C71748A309C7}.Debug|x86.Build.0 = Debug|Any CPU - {C8182EF0-77FB-4B43-A588-C71748A309C7}.Native|Any CPU.ActiveCfg = Debug|Any CPU - {C8182EF0-77FB-4B43-A588-C71748A309C7}.Native|ARM.ActiveCfg = Debug|Any CPU - {C8182EF0-77FB-4B43-A588-C71748A309C7}.Native|ARM64.ActiveCfg = Debug|Any CPU - {C8182EF0-77FB-4B43-A588-C71748A309C7}.Native|x64.ActiveCfg = Debug|Any CPU - {C8182EF0-77FB-4B43-A588-C71748A309C7}.Native|x86.ActiveCfg = Debug|Any CPU {C8182EF0-77FB-4B43-A588-C71748A309C7}.Release|Any CPU.ActiveCfg = Release|Any CPU {C8182EF0-77FB-4B43-A588-C71748A309C7}.Release|Any CPU.Build.0 = Release|Any CPU {C8182EF0-77FB-4B43-A588-C71748A309C7}.Release|ARM.ActiveCfg = Release|Any CPU From 6a5399a637b694234f5a3258bed705dd1309d1c1 Mon Sep 17 00:00:00 2001 From: YoshiAsk Date: Mon, 2 Nov 2020 16:05:10 -0600 Subject: [PATCH 2/5] Add very minimal sample [WIP] --- Microsoft.Toolkit.Uwp.SampleApp/App.xaml | 34 +- .../Microsoft.Toolkit.Uwp.SampleApp.csproj | 11 + .../TabbedCommandBar/TabbedCommandBar.bind | 16 + .../TabbedCommandBarPage.xaml | 17 + .../TabbedCommandBarPage.xaml.cs | 30 + ...soft.Toolkit.Uwp.UI.Controls.Design.csproj | 1 + .../TabbedCommandBarMetadata.cs | 33 + .../TabbedCommandBar/TabbedCommandBar.xaml | 590 ++++++++++++++++++ .../TabbedCommandBar/TabbedCommandBarItem.cs | 2 +- 9 files changed, 716 insertions(+), 18 deletions(-) create mode 100644 Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TabbedCommandBar/TabbedCommandBar.bind create mode 100644 Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TabbedCommandBar/TabbedCommandBarPage.xaml create mode 100644 Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TabbedCommandBar/TabbedCommandBarPage.xaml.cs create mode 100644 Microsoft.Toolkit.Uwp.UI.Controls.Design/TabbedCommandBarMetadata.cs diff --git a/Microsoft.Toolkit.Uwp.SampleApp/App.xaml b/Microsoft.Toolkit.Uwp.SampleApp/App.xaml index f7b74b15f8d..37bc22cada3 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/App.xaml +++ b/Microsoft.Toolkit.Uwp.SampleApp/App.xaml @@ -4,25 +4,25 @@ xmlns:converters="using:Microsoft.Toolkit.Uwp.UI.Converters" RequiresPointerMode="Auto"> - - - - - - + + + + + + - - - + + + - - + + - + - - - + + + \ No newline at end of file diff --git a/Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj b/Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj index c7acab21bfa..59b9063ee9d 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj +++ b/Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj @@ -515,6 +515,9 @@ FocusBehaviorPage.xaml + + TabbedCommandBarPage.xaml + TilesBrushPage.xaml @@ -1001,6 +1004,14 @@ MSBuild:Compile Designer + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + MSBuild:Compile Designer diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TabbedCommandBar/TabbedCommandBar.bind b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TabbedCommandBar/TabbedCommandBar.bind new file mode 100644 index 00000000000..0132eb6dcd0 --- /dev/null +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TabbedCommandBar/TabbedCommandBar.bind @@ -0,0 +1,16 @@ + + + + + + + + + + + diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TabbedCommandBar/TabbedCommandBarPage.xaml b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TabbedCommandBar/TabbedCommandBarPage.xaml new file mode 100644 index 00000000000..43c51189031 --- /dev/null +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TabbedCommandBar/TabbedCommandBarPage.xaml @@ -0,0 +1,17 @@ + + + + + + + + + diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TabbedCommandBar/TabbedCommandBarPage.xaml.cs b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TabbedCommandBar/TabbedCommandBarPage.xaml.cs new file mode 100644 index 00000000000..77e088b3dc4 --- /dev/null +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TabbedCommandBar/TabbedCommandBarPage.xaml.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Windows.Foundation; +using Windows.Foundation.Collections; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Controls.Primitives; +using Windows.UI.Xaml.Data; +using Windows.UI.Xaml.Input; +using Windows.UI.Xaml.Media; +using Windows.UI.Xaml.Navigation; + +// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 + +namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages +{ + /// + /// An empty page that can be used on its own or navigated to within a Frame. + /// + public sealed partial class TabbedCommandBarPage : Page + { + public TabbedCommandBarPage() + { + this.InitializeComponent(); + } + } +} diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Design/Microsoft.Toolkit.Uwp.UI.Controls.Design.csproj b/Microsoft.Toolkit.Uwp.UI.Controls.Design/Microsoft.Toolkit.Uwp.UI.Controls.Design.csproj index 1201d323388..ada3759c203 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.Design/Microsoft.Toolkit.Uwp.UI.Controls.Design.csproj +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Design/Microsoft.Toolkit.Uwp.UI.Controls.Design.csproj @@ -122,6 +122,7 @@ + diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Design/TabbedCommandBarMetadata.cs b/Microsoft.Toolkit.Uwp.UI.Controls.Design/TabbedCommandBarMetadata.cs new file mode 100644 index 00000000000..44a2343c54b --- /dev/null +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Design/TabbedCommandBarMetadata.cs @@ -0,0 +1,33 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Windows.Design.Metadata; +using Microsoft.Windows.Design.PropertyEditing; +using System.ComponentModel; + +namespace Microsoft.Toolkit.Uwp.UI.Controls.Design +{ + internal class TabbedCommandBarMetadata : AttributeTableBuilder + { + public TabbedCommandBarMetadata() + : base() + { + AddCallback(typeof(TabbedCommandBar), + b => + { + b.AddCustomAttributes(nameof(TabbedCommandBar.Items), + new PropertyOrderAttribute(PropertyOrder.Early), + new CategoryAttribute(Properties.Resources.CategoryCommon), + //The following is necessary because this is a collection of an abstract type, so we help + //the designer with populating supported types that can be added to the collection + new NewItemTypesAttribute(new System.Type[] { + typeof(TabbedCommandBarItem), + }), + new AlternateContentPropertyAttribute() + ); + } + ); + } + } +} diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBar.xaml b/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBar.xaml index 75732830e3a..3db435ffd8b 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBar.xaml +++ b/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBar.xaml @@ -440,4 +440,594 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBarItem.cs b/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBarItem.cs index 5dc727a0453..9d53cb88861 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBarItem.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBarItem.cs @@ -32,7 +32,7 @@ public TabbedCommandBarItem() nameof(Header), typeof(string), typeof(TabbedCommandBarItem), - new PropertyMetadata(string.Empty)); + new PropertyMetadata("Test")); /// /// Gets or sets the title of this ribbon tab. From b79e75e5a07d2d109eb58b9493ad88479fcf24eb Mon Sep 17 00:00:00 2001 From: YoshiAsk Date: Mon, 2 Nov 2020 18:50:31 -0600 Subject: [PATCH 3/5] Update samples.json --- .../SamplePages/samples.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/samples.json b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/samples.json index 1a5c5303b40..37b737ea939 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/samples.json +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/samples.json @@ -433,6 +433,16 @@ "XamlCodeFile": "TokenizingTextBoxXaml.bind", "Icon": "/SamplePages/TokenizingTextBox/TokenizingTextBox.png", "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/TokenizingTextBox.md" + }, + { + "Name": "TabbedCommandBar", + "Type": "TabbedCommandBarPage", + "Subcategory": "Layout", + "About": "A text input control that makes suggestions and keeps track of data token items", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar", + "XamlCodeFile": "TabbedCommandBar.bind", + "Icon": "/SamplePages/TokenizingTextBox/TokenizingTextBox.png", + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/TabbedCommandBar.md" } ] }, From 9303c405a4acffe3f497fe847e11aecf65bea9c8 Mon Sep 17 00:00:00 2001 From: Joshua Askharoun Date: Mon, 2 Nov 2020 19:45:04 -0600 Subject: [PATCH 4/5] Add thumbnail for TabbedCommandBar and update doc link (even though docs don't exist yet) --- .../Microsoft.Toolkit.Uwp.SampleApp.csproj | 1 + .../TabbedCommandBar/TabbedCommandBar.png | Bin 0 -> 2590 bytes .../SamplePages/samples.json | 4 ++-- 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TabbedCommandBar/TabbedCommandBar.png diff --git a/Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj b/Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj index 59b9063ee9d..6b37565291a 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj +++ b/Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj @@ -272,6 +272,7 @@ + diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TabbedCommandBar/TabbedCommandBar.png b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TabbedCommandBar/TabbedCommandBar.png new file mode 100644 index 0000000000000000000000000000000000000000..9761391a31c4ad3f84e7ee66d5efcfef8dfef95f GIT binary patch literal 2590 zcmd^B`%@EF6y7Kmlq!gd_^LaLG7cr#JS37e3nBqQO`sAG)KQmY6IPOJnq5r52NV@w z_^zV}=(N73RTQ-rE!I~RsA5q^i!CZDO2A-*kGszOL!)&rJm;*<6zZm%DwowG;DQp^!B&p-z2--%%!J=T17zynGD{XoMHc1uL zVhmO|lFG7H3`OmByT~pR(KaJ0Q79CsSc*!eLckC*85Wjs2rZ01=fdSfMKU@YWo0Sa z0&_lz6gr*75d`3Hi*wRJwRyKNE$IUxP!2&QA~D*Y&QgZ=&^e?7-I_|XG?PkOTN8Ne zh*r3RA&{?g69-}KjI36Fm~J+|l?KB`&IUrXi27DcZw_Fz8CDXVL^5=`O-Dw~CM~Q# zuLP$H7DqWqQ<91@lNJW3izCvIkay7JcBn)lZ9^ky6K#tJZAIdUgx}`0!(z;Yk(^BF z+0-^~ZNNm*V&srFo_K_d&XmrTH^D-Id|Zd{P*NL)BQmiVbQV{29!u^VYpn*xN2sRt zAV3*!)&|8yM8w%>17!jjGilsdI3_YeE>XzkLaE4=3@9B2Y$-#AieLdtDwc|c5{XbO z)k+kYOoB;93B__u>XvCWIHPxT0KI>Z%CW|<=B!wWJTr82?9;Y@1Ma}Q$D~laqx~_a0 zaW1cB4t-I-%hYeUe7?}>c_lDy`;sqr2klx`yxv*+~St;XVI zmdXZ`Ogb>pkaA%BW&eZD$8qY#JEoTFS=IL4KVFO8b|qow)LnD09!o4+UBW)rdV1Z< zr94-4j}5BLJzH>6ojGNycc^c#O}6lxX_Hs=Z~FO;c1_qc`Q=J)$DoDlFQF@&Q*g6k z(VaVP`}2>yW`;Hnf331$foZ#{e1niYpD3b`$o07JQ?}E)=-I{LqtD#7XZ;boZ`k1< z91FSxEZ-Kb>(e(Fz1(MiKxAxXWt{b8bLrm1{d-H3t_{sS<6e&lbDF)dab87} z5~{-s?~HGnFz0-8;ET){&j({)1r`==_|EBDxF`H+(O3Dum)>4?R~>M($>Uzic}MqP z=Je)Qg^a`V-m%7>huekPLCMzg(hdn*OC)gg)iq^ zZ%pX>ph}x%2q^vSv|oKaGNdD;)inRs zhVxSuVPSQ5n+ggBJw0+uDPDZq*+ey7%iFK*pBsce1>Y#;axbfSkAcKdrBB*;&Gn61%h8a5iP*40%@y~Hb$ zyRdfqsEU#E_3m@Zdw*P6wZAKd<3+lGGpnn7V7u)2mXI7iwb4UQh){HAl6%QwdBHhN zb*{)XdoVN&nR1n)|yB95_%Nzmjr)pQ@d@`d}UY zhZa>&E_D@cIBUQEJo6s$#TDD(xuc$MT<4y8aLT+X#fkA=p8qT!eBw<5kFFD# Date: Tue, 3 Nov 2020 13:10:31 -0600 Subject: [PATCH 5/5] Added slightly mroe detailed sample --- .../TabbedCommandBar/TabbedCommandBar.bind | 81 +++++++++++++++++-- .../TabbedCommandBar/TabbedCommandBar.xaml | 75 +---------------- 2 files changed, 77 insertions(+), 79 deletions(-) diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TabbedCommandBar/TabbedCommandBar.bind b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TabbedCommandBar/TabbedCommandBar.bind index 0132eb6dcd0..690e3e93bd7 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TabbedCommandBar/TabbedCommandBar.bind +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TabbedCommandBar/TabbedCommandBar.bind @@ -5,12 +5,79 @@ xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls" mc:Ignorable="d"> - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBar.xaml b/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBar.xaml index 3db435ffd8b..ba203b27af1 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBar.xaml +++ b/Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBar.xaml @@ -14,7 +14,7 @@ @@ -700,27 +700,11 @@ + - @@ -730,7 +714,7 @@ Grid.Row="0" HorizontalAlignment="Stretch" VerticalAlignment="Top" - Background="{ThemeResource NavigationViewTopPaneBackground}" + Background="{TemplateBinding Background}" Canvas.ZIndex="1" XYFocusKeyboardNavigation="Enabled"> - @@ -815,15 +798,11 @@ HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsTabStop="False" /> - - @@ -867,10 +846,6 @@ VerticalContentAlignment="Stretch" IsTabStop="False" /> - - @@ -940,14 +914,6 @@ - @@ -956,33 +922,6 @@ - @@ -1016,14 +955,6 @@ -