Skip to content

Commit 2e495ad

Browse files
committed
feat: NavigationView InfoBadge integration
1 parent 96ae680 commit 2e495ad

32 files changed

+4460
-126
lines changed

src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/NavigationViewTests/Common/NavigationViewInfoBadge.xaml

Lines changed: 3912 additions & 0 deletions
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Runtime.InteropServices.WindowsRuntime;
6+
using Windows.Foundation;
7+
using Windows.Foundation.Collections;
8+
using Windows.UI.Xaml;
9+
using Windows.UI.Xaml.Controls;
10+
using Windows.UI.Xaml.Controls.Primitives;
11+
using Windows.UI.Xaml.Data;
12+
using Windows.UI.Xaml.Input;
13+
using Windows.UI.Xaml.Media;
14+
using Windows.UI.Xaml.Navigation;
15+
using Uno.UI.Samples.Controls;
16+
17+
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
18+
19+
namespace MUXControlsTestApp
20+
{
21+
/// <summary>
22+
/// An empty page that can be used on its own or navigated to within a Frame.
23+
/// </summary>
24+
[Sample("NavigationView", "WinUI")]
25+
public sealed partial class NavigationViewInfoBadgeTestPage : MUXControlsTestApp.TestPage
26+
{
27+
public NavigationViewInfoBadgeTestPage()
28+
{
29+
this.InitializeComponent();
30+
}
31+
32+
private void FlipOrientationButton_Clicked(object sender, RoutedEventArgs e)
33+
{
34+
NavView.PaneDisplayMode = NavView.PaneDisplayMode == Microsoft.UI.Xaml.Controls.NavigationViewPaneDisplayMode.Top ? Microsoft.UI.Xaml.Controls.NavigationViewPaneDisplayMode.Auto : Microsoft.UI.Xaml.Controls.NavigationViewPaneDisplayMode.Top;
35+
}
36+
}
37+
}

src/SamplesApp/UITests.Shared/UITests.Shared.projitems

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@
6565
<SubType>Designer</SubType>
6666
<Generator>MSBuild:Compile</Generator>
6767
</Page>
68+
<Page Include="$(MSBuildThisFileDirectory)Microsoft_UI_Xaml_Controls\NavigationViewTests\Common\NavigationViewInfoBadge.xaml">
69+
<SubType>Designer</SubType>
70+
<Generator>MSBuild:Compile</Generator>
71+
</Page>
6872
<Page Include="$(MSBuildThisFileDirectory)Microsoft_UI_Xaml_Controls\NavigationViewTests\Common\NavigationViewInitPage.xaml">
6973
<SubType>Designer</SubType>
7074
<Generator>MSBuild:Compile</Generator>
@@ -4397,6 +4401,9 @@
43974401
<Compile Include="$(MSBuildThisFileDirectory)Microsoft_UI_Xaml_Controls\NavigationViewTests\Common\NavigationViewCompactPaneLengthTestPage.xaml.cs">
43984402
<DependentUpon>NavigationViewCompactPaneLengthTestPage.xaml</DependentUpon>
43994403
</Compile>
4404+
<Compile Include="$(MSBuildThisFileDirectory)Microsoft_UI_Xaml_Controls\NavigationViewTests\Common\NavigationViewInfoBadge.xaml.cs">
4405+
<DependentUpon>NavigationViewInfoBadge.xaml</DependentUpon>
4406+
</Compile>
44004407
<Compile Include="$(MSBuildThisFileDirectory)Microsoft_UI_Xaml_Controls\NavigationViewTests\Common\NavigationViewInitPage.xaml.cs">
44014408
<DependentUpon>NavigationViewInitPage.xaml</DependentUpon>
44024409
</Compile>

src/Uno.UI.FluentTheme.v1/themeresources_v1.xaml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<ResourceDictionary xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="ios android wasm skia" xmlns:media="using:Microsoft.UI.Xaml.Media" xmlns:controls="using:Microsoft.UI.Xaml.Controls" xmlns:primitives="using:Microsoft.UI.Xaml.Controls.Primitives" xmlns:wasm="http://uno.ui/wasm" xmlns:uno="using:Uno.UI.Xaml.Controls" xmlns:automation="clr-namespace:Windows.UI.Xaml.Automation" xmlns:netstdref="http://uno.ui/netstdref" xmlns:skia="http://uno.ui/skia" xmlns:not_mux="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:contract4Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,4)" xmlns:contract4NotPresent="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractNotPresent(Windows.Foundation.UniversalApiContract,4)" xmlns:contract7Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,7)" xmlns:contract7NotPresent="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractNotPresent(Windows.Foundation.UniversalApiContract,7)" xmlns:primitiveContract7Present="using:Microsoft.UI.Xaml.Controls.Primitives?IsApiContractPresent(Windows.Foundation.UniversalApiContract,7)" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:unouwp="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractNotPresent(Uno.WinUI,1)" xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:contract6Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,6)" xmlns:ios="http://platform.uno/ios" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
1+
<ResourceDictionary xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="ios android wasm skia" xmlns:media="using:Microsoft.UI.Xaml.Media" xmlns:controls="using:Microsoft.UI.Xaml.Controls" xmlns:primitives="using:Microsoft.UI.Xaml.Controls.Primitives" xmlns:wasm="http://uno.ui/wasm" xmlns:uno="using:Uno.UI.Xaml.Controls" xmlns:automation="clr-namespace:Windows.UI.Xaml.Automation" xmlns:netstdref="http://uno.ui/netstdref" xmlns:skia="http://uno.ui/skia" xmlns:not_mux="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:animatedvisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals" xmlns:contract7Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,7)" xmlns:contract7NotPresent="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractNotPresent(Windows.Foundation.UniversalApiContract,7)" xmlns:contract4Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,4)" xmlns:contract4NotPresent="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractNotPresent(Windows.Foundation.UniversalApiContract,4)" xmlns:primitiveContract7Present="using:Microsoft.UI.Xaml.Controls.Primitives?IsApiContractPresent(Windows.Foundation.UniversalApiContract,7)" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:unouwp="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractNotPresent(Uno.WinUI,1)" xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:contract6Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,6)" xmlns:ios="http://platform.uno/ios" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
22
<ResourceDictionary.ThemeDictionaries>
33
<ResourceDictionary xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="ios android wasm skia" x:Key="Default">
44
<Color x:Key="TextFillColorPrimary">#FFFFFF</Color>
@@ -15408,10 +15408,12 @@
1540815408
<Setter Property="VerticalContentAlignment" Value="Center" />
1540915409
<Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}" />
1541015410
<Setter Property="Content" Value="&#xE72B;" />
15411+
<Setter Property="Margin" Value="4,2" />
15412+
<contract7Present:Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
1541115413
<Setter Property="Template">
1541215414
<Setter.Value>
1541315415
<ControlTemplate TargetType="Button">
15414-
<Grid x:Name="RootGrid" Background="{TemplateBinding Background}">
15416+
<Grid x:Name="RootGrid" Background="{TemplateBinding Background}" contract7Present:CornerRadius="{TemplateBinding CornerRadius}" contract7NotPresent:CornerRadius="{ThemeResource ControlCornerRadius}">
1541515417
<VisualStateManager.VisualStateGroups>
1541615418
<VisualStateGroup x:Name="CommonStates">
1541715419
<VisualState x:Name="Normal" />
@@ -15424,6 +15426,9 @@
1542415426
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource NavigationViewButtonForegroundPointerOver}" />
1542515427
</ObjectAnimationUsingKeyFrames>
1542615428
</Storyboard>
15429+
<VisualState.Setters>
15430+
<Setter Target="Content.(controls:AnimatedIcon.State)" Value="PointerOver" />
15431+
</VisualState.Setters>
1542715432
</VisualState>
1542815433
<VisualState x:Name="Pressed">
1542915434
<Storyboard>
@@ -15434,6 +15439,9 @@
1543415439
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource NavigationViewButtonForegroundPressed}" />
1543515440
</ObjectAnimationUsingKeyFrames>
1543615441
</Storyboard>
15442+
<VisualState.Setters>
15443+
<Setter Target="Content.(controls:AnimatedIcon.State)" Value="Pressed" />
15444+
</VisualState.Setters>
1543715445
</VisualState>
1543815446
<VisualState x:Name="Disabled">
1543915447
<Storyboard>
@@ -15444,16 +15452,19 @@
1544415452
</VisualState>
1544515453
</VisualStateGroup>
1544615454
</VisualStateManager.VisualStateGroups>
15447-
<FontIcon x:Name="Content" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" Glyph="{TemplateBinding Content}" MirroredWhenRightToLeft="True" Foreground="{TemplateBinding Foreground}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" AutomationProperties.AccessibilityView="Raw" />
15455+
<controls:AnimatedIcon x:Name="Content" Height="16" Width="16" local:AnimatedIcon.State="Normal" MirroredWhenRightToLeft="True" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" AutomationProperties.AccessibilityView="Raw" xmlns:local="using:Microsoft.UI.Xaml.Controls">
15456+
<animatedvisuals:AnimatedBackVisualSource />
15457+
<controls:AnimatedIcon.FallbackIconSource>
15458+
<controls:FontIconSource FontSize="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=FontSize}" FontFamily="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=FontFamily}" Glyph="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content}" MirroredWhenRightToLeft="True" />
15459+
</controls:AnimatedIcon.FallbackIconSource>
15460+
</controls:AnimatedIcon>
1544815461
</Grid>
1544915462
</ControlTemplate>
1545015463
</Setter.Value>
1545115464
</Setter>
1545215465
</Style>
1545315466
<Style x:Key="NavigationBackButtonSmallStyle" TargetType="Button" BasedOn="{StaticResource NavigationBackButtonNormalStyle}">
15454-
<Setter Property="FontSize" Value="20" />
15455-
<Setter Property="Height" Value="32" />
15456-
<Setter Property="Width" Value="32" />
15467+
<Setter Property="Margin" Value="4,2,0,2" />
1545715468
</Style>
1545815469
<Thickness x:Key="NavigationViewAutoSuggestBoxMargin">10,0,16,0</Thickness>
1545915470
<Thickness x:Key="TopNavigationViewAutoSuggestBoxMargin">12,0,12,0</Thickness>

src/Uno.UI.FluentTheme.v2/Resources/Version2/PriorityDefault/NavigationBackButton.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. -->
2+
<!-- MUX reference NavigationBackButton_v1.xaml, commit d2acc14 -->
23
<ResourceDictionary
34
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
45
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

src/Uno.UI.FluentTheme.v2/Resources/Version2/PriorityDefault/NavigationBackButton_rs1_themeresources.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. -->
2+
<!-- MUX reference NavigationBackButton_v1.xaml, commit f2df41d -->
23
<ResourceDictionary
34
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
45
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

src/Uno.UI.FluentTheme.v2/Resources/Version2/PriorityDefault/NavigationView.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -401,10 +401,10 @@
401401
DisplayMode="Inline"
402402
IsPaneOpen="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsPaneOpen, Mode=TwoWay}"
403403
IsTabStop="False"
404-
OpenPaneLength="{TemplateBinding OpenPaneLength}"
404+
OpenPaneLength="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.OpenPaneWidth}"
405405
PaneBackground="{ThemeResource NavigationViewDefaultPaneBackground}"
406406
Grid.Row="1"
407-
contract7Present:CornerRadius="{ThemeResource OverlayCornerRadius}">
407+
contract7Present:CornerRadius="{Binding Source={ThemeResource OverlayCornerRadius}, Converter={StaticResource RightCornerRadiusFilterConverter}}">
408408

409409
<SplitView.Pane>
410410
<Grid
@@ -615,7 +615,7 @@
615615
<Grid
616616
x:Name="ShadowCaster"
617617
Grid.RowSpan="2"
618-
Width="{TemplateBinding OpenPaneLength}"
618+
Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.OpenPaneWidth}"
619619
HorizontalAlignment="Left">
620620
<Grid.RenderTransform>
621621
<CompositeTransform x:Name="ShadowCasterTransform" />
@@ -731,7 +731,6 @@
731731
<VisualState x:Name="OnTopNavigationPrimary">
732732
<VisualState.Setters>
733733
<Setter Target="NavigationViewItemPresenter.Margin" Value="{ThemeResource TopNavigationViewItemMargin}"/>
734-
<Setter Target="NavigationViewItemPresenter.Foreground" Value="{ThemeResource TopNavigationViewItemForeground}" />
735734
<Setter Target="NavigationViewItemPresenter.Style" Value="{StaticResource MUX_NavigationViewItemPresenterStyleWhenOnTopPane}" />
736735
<contract7NotPresent:Setter Target="ChildrenFlyout.Placement" Value="Bottom"/>
737736
<contract7Present:Setter Target="ChildrenFlyout.Placement" Value="BottomEdgeAlignedLeft"/>
@@ -748,6 +747,7 @@
748747
<primitives:NavigationViewItemPresenter
749748
x:Name="NavigationViewItemPresenter"
750749
Icon="{TemplateBinding Icon}"
750+
InfoBadge="{TemplateBinding InfoBadge}"
751751
ContentTransitions="{TemplateBinding ContentTransitions}"
752752
ContentTemplate="{TemplateBinding ContentTemplate}"
753753
Padding="{TemplateBinding Padding}"

0 commit comments

Comments
 (0)