Skip to content

Commit 1f352bf

Browse files
committed
Moved TabbedCommandBarItem default templates to TabbedCommandBarItem.xaml
1 parent 66274ca commit 1f352bf

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBar.xaml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,6 @@
66
<ResourceDictionary Source="ms-appx:///Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBarItem.xaml" />
77
</ResourceDictionary.MergedDictionaries>
88

9-
<SolidColorBrush x:Key="ContextualTabBackground" Color="{StaticResource SystemAltMediumColor}"/>
10-
11-
<DataTemplate x:Key="NormalTabTemplate">
12-
<NavigationViewItem Content="{Binding Header}" Visibility="{Binding Visibility}"/>
13-
</DataTemplate>
14-
<DataTemplate x:Key="ContextualTabTemplate">
15-
<NavigationViewItem Content="{Binding Header}" Background="{StaticResource ContextualTabBackground}" Visibility="{Binding Visibility}">
16-
<NavigationViewItem.Resources>
17-
<SolidColorBrush x:Key="TopNavigationViewItemForeground" Color="{ThemeResource SystemAccentColor}" />
18-
<SolidColorBrush x:Key="TopNavigationViewItemForegroundSelected" Color="{ThemeResource SystemAccentColor}" />
19-
<SolidColorBrush x:Key="TopNavigationViewItemForegroundPointerOver" Color="{ThemeResource SystemAccentColorLight2}" />
20-
<SolidColorBrush x:Key="TopNavigationViewItemForegroundPressed" Color="{ThemeResource SystemAccentColorLight2}" />
21-
22-
<!-- TODO: Set BackgroundSelected to match ContextualTabBackground -->
23-
<!--<StaticResource x:Key="TopNavigationViewItemBackgroundSelected" ResourceKey="ContextualTabBackgroundColor" />-->
24-
</NavigationViewItem.Resources>
25-
</NavigationViewItem>
26-
</DataTemplate>
27-
<controls:TabbedCommandBarItemTemplateSelector x:Key="DefaultTabbedCommandBarItemTemplateSelector"
28-
Contextual="{StaticResource ContextualTabTemplate}"
29-
Normal="{StaticResource NormalTabTemplate}" />
30-
319
<Style BasedOn="{StaticResource DefaultTabbedCommandBarStyle}" TargetType="controls:TabbedCommandBar"/>
3210

3311
<Style x:Key="DefaultTabbedCommandBarStyle" TargetType="controls:TabbedCommandBar">

Microsoft.Toolkit.Uwp.UI.Controls/TabbedCommandBar/TabbedCommandBarItem.xaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
33
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls">
44

5+
<SolidColorBrush x:Key="ContextualTabBackground" Color="{StaticResource SystemAltMediumColor}"/>
6+
57
<Style BasedOn="{StaticResource DefaultTabbedCommandBarItemStyle}" TargetType="controls:TabbedCommandBarItem"/>
68

79
<Style x:Key="DefaultTabbedCommandBarItemStyle" BasedOn="{StaticResource CommandBarRevealStyle}" TargetType="controls:TabbedCommandBarItem">
@@ -22,6 +24,26 @@
2224
<Setter Property="Background" Value="{ThemeResource SystemControlChromeLowAcrylicWindowBrush}"/>
2325
</Style>
2426

27+
<DataTemplate x:Key="NormalTabTemplate">
28+
<NavigationViewItem Content="{Binding Header}" Visibility="{Binding Visibility}"/>
29+
</DataTemplate>
30+
<DataTemplate x:Key="ContextualTabTemplate">
31+
<NavigationViewItem Content="{Binding Header}" Background="{StaticResource ContextualTabBackground}" Visibility="{Binding Visibility}">
32+
<NavigationViewItem.Resources>
33+
<SolidColorBrush x:Key="TopNavigationViewItemForeground" Color="{ThemeResource SystemAccentColor}" />
34+
<SolidColorBrush x:Key="TopNavigationViewItemForegroundSelected" Color="{ThemeResource SystemAccentColor}" />
35+
<SolidColorBrush x:Key="TopNavigationViewItemForegroundPointerOver" Color="{ThemeResource SystemAccentColorLight2}" />
36+
<SolidColorBrush x:Key="TopNavigationViewItemForegroundPressed" Color="{ThemeResource SystemAccentColorLight2}" />
37+
38+
<!-- TODO: Set BackgroundSelected to match ContextualTabBackground -->
39+
<!--<StaticResource x:Key="TopNavigationViewItemBackgroundSelected" ResourceKey="ContextualTabBackgroundColor" />-->
40+
</NavigationViewItem.Resources>
41+
</NavigationViewItem>
42+
</DataTemplate>
43+
<controls:TabbedCommandBarItemTemplateSelector x:Key="DefaultTabbedCommandBarItemTemplateSelector"
44+
Contextual="{StaticResource ContextualTabTemplate}"
45+
Normal="{StaticResource NormalTabTemplate}" />
46+
2547
<Style x:Key="AppBarSplitButtonStyle" TargetType="SplitButton">
2648
<Setter Property="Background" Value="{ThemeResource AppBarButtonRevealBackground}" />
2749
<Setter Property="Foreground" Value="{ThemeResource SplitButtonForeground}" />

0 commit comments

Comments
 (0)