Skip to content

Commit

Permalink
fix: remove nav bar back icon, use symbol/path for non-win/non-mobile (
Browse files Browse the repository at this point in the history
…#860)

(cherry picked from commit 7e94607)
  • Loading branch information
kazo0 authored and mergify[bot] committed Oct 2, 2023
1 parent 9454a1f commit d786c47
Show file tree
Hide file tree
Showing 21 changed files with 20 additions and 30 deletions.
6 changes: 5 additions & 1 deletion doc/controls/NavigationBar.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,10 @@ If no `MainCommand` is provided in the XAML, the `NavigationBar` will render the

On **Android**, only icons are supported (`AppBarButton.Icon`). This is due to a platform limitation, which can be explained by the fact that `NavigationBar.Content` is left-aligned.

> [!WARNING]
> Due to [platform limitations](https://github.com/microsoft/microsoft-ui-xaml/issues/1494) on Windows only, a default back button icon is not provided out of the box. You will need to provide your own icon on each instance of the `NavigationBar` where you want to display a back button. On Android and iOS, the native default back button icon is used. On all other platforms, a back button icon is bundled in the default styles for the `NavigationBar`.

### MainCommand Properties

### Label
Expand Down Expand Up @@ -390,7 +394,7 @@ Gets or sets the back button icon for the `MainCommand`.

Remarks:

Only supports `BitmapImage`
Only supports `BitmapImage` on iOS/Android

## Lightweight Styling

Expand Down
Binary file removed src/Uno.Toolkit.UI/Assets/BackIcon.scale-100.png
Binary file not shown.
Binary file removed src/Uno.Toolkit.UI/Assets/BackIcon.scale-150.png
Binary file not shown.
Binary file removed src/Uno.Toolkit.UI/Assets/BackIcon.scale-200.png
Binary file not shown.
Binary file removed src/Uno.Toolkit.UI/Assets/BackIcon.scale-300.png
Binary file not shown.
Binary file removed src/Uno.Toolkit.UI/Assets/BackIcon.scale-400.png
Binary file not shown.
12 changes: 7 additions & 5 deletions src/Uno.Toolkit.UI/Controls/NavigationBar/NavigationBar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
xmlns:ios="http://uno.ui/ios"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mobile="http://uno.ui/mobile"
xmlns:not_win="http://uno.ui/not_win"
xmlns:not_mobile="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:toolkit="using:Uno.UI.Toolkit"
xmlns:utu="using:Uno.Toolkit.UI"
xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
mc:Ignorable="android ios mobile">
mc:Ignorable="android ios mobile not_win">

<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
Expand All @@ -40,10 +41,11 @@

<Style x:Key="DefaultMainCommandStyle"
TargetType="AppBarButton">
<not_mobile:Setter Property="Icon">
<not_mobile:Setter.Value>
<BitmapIcon UriSource="{StaticResource BackButtonUriSource}" />
</not_mobile:Setter.Value>
<!-- Native back icons are used on mobile platforms -->
<not_mobile:Setter Property="Icon" win:Value="{x:Null}">
<not_win:Setter.Value>
<SymbolIcon Symbol="Back" />
</not_win:Setter.Value>
</not_mobile:Setter>
</Style>

Expand Down
4 changes: 0 additions & 4 deletions src/Uno.Toolkit.UI/Resources/AssetCatalog.UWP.xaml

This file was deleted.

4 changes: 0 additions & 4 deletions src/Uno.Toolkit.UI/Resources/AssetCatalog.WinUI.xaml

This file was deleted.

1 change: 0 additions & 1 deletion src/Uno.Toolkit.UI/Uno.Toolkit.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@

<ItemGroup>
<UpToDateCheckInput Include="**\*.xaml" Exclude="bin\**\*.xaml;obj\**\*.xaml" />
<Content Include="Assets\**\*.png" />
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion src/Uno.Toolkit.UI/xamlmerge-toolkit.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<ItemGroup>
<XamlMergeInput Include="Controls\**\*.xaml" />
<XamlMergeInput Include="Behaviors\**\*.xaml" />
<XamlMergeInput Include="Resources\AssetCatalog.$(FrameworkLineage).xaml" />
</ItemGroup>

<Import Project="..\xamlmerge.props" />
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
xmlns:toolkit="using:Uno.UI.Toolkit"
xmlns:um="using:Uno.Material"
xmlns:utu="using:Uno.Toolkit.UI"
xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
mc:Ignorable="android ios not_win mobile">

<ResourceDictionary.ThemeDictionaries>
Expand Down Expand Up @@ -81,6 +82,7 @@
<x:Double x:Key="NavBarAppBarThemeCompactHeight">56</x:Double>
<Thickness x:Key="NavBarAppBarButtonPadding">12,16,12,16</Thickness>
<Visibility x:Key="NavBarAppBarButtonHasFlyoutChevronVisibility">Collapsed</Visibility>
<x:String x:Key="NavigationBarBackIconData">M20 11H7.83L13.42 5.41L12 4L4 12L12 20L13.41 18.59L7.83 13H20V11Z</x:String>
</ResourceDictionary>
<ResourceDictionary x:Key="Light">
<StaticResource x:Key="NavigationBarCommandBarEllipsisIconForegroundDisabled" ResourceKey="CommandBarEllipsisIconForegroundDisabled" />
Expand Down Expand Up @@ -137,6 +139,7 @@
<x:Double x:Key="NavBarAppBarThemeCompactHeight">56</x:Double>
<Thickness x:Key="NavBarAppBarButtonPadding">12,16,12,16</Thickness>
<Visibility x:Key="NavBarAppBarButtonHasFlyoutChevronVisibility">Collapsed</Visibility>
<x:String x:Key="NavigationBarBackIconData">M20 11H7.83L13.42 5.41L12 4L4 12L12 20L13.41 18.59L7.83 13H20V11Z</x:String>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>

Expand Down Expand Up @@ -178,10 +181,11 @@
BasedOn="{StaticResource MaterialAppBarButtonStyle}"
TargetType="AppBarButton">
<Setter Property="Foreground" Value="{ThemeResource NavigationBarMainCommandForeground}" />
<not_mobile:Setter Property="Icon">
<not_mobile:Setter.Value>
<BitmapIcon UriSource="{StaticResource MaterialBackButtonUriSource}" />
</not_mobile:Setter.Value>
<!-- Native back icons are used on mobile platforms -->
<not_mobile:Setter Property="Icon" win:Value="{x:Null}">
<not_win:Setter.Value>
<PathIcon Data="{ThemeResource NavigationBarBackIconData}" />
</not_win:Setter.Value>
</not_mobile:Setter>
</Style>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

<ItemGroup>
<UpToDateCheckInput Include="**\*.xaml" Exclude="bin\**\*.xaml;obj\**\*.xaml" />
<Content Include="Assets\**\*.png" />
</ItemGroup>

<ItemGroup Condition="$(IsXamarinIOS) or $(IsMonoAndroid) or $(IsXamarinMac)">
Expand Down
1 change: 0 additions & 1 deletion src/library/Uno.Toolkit.Material/xamlmerge-material.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

<XamlMergeInput Include="Styles\Controls\v1\**\*.xaml" MergeFile="mergedpages.$(FrameworkLineage).v1.xaml" />
<XamlMergeInput Include="Styles\Controls\v2\**\*.xaml" MergeFile="mergedpages.$(FrameworkLineage).v2.xaml" />
<XamlMergeInput Include="Resources\AssetCatalog.$(FrameworkLineage).xaml" MergeFile="mergedpages.$(FrameworkLineage).v2.xaml" />
</ItemGroup>
<Import Project="..\..\xamlmerge.props" />
</Project>

0 comments on commit d786c47

Please sign in to comment.