无法更改 xamarin 表单 UWP 中 shell 页面的汉堡菜单图标

时间:2021-05-12 05:50:16

标签: uwp xamarin-forms-shell

我使用的是 xamarin 形式的 Shell Page。我需要更改汉堡菜单图标。下面是我的代码

<Shell xmlns="http://xamarin.com/schemas/2014/forms"
       xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
       xmlns:controls="clr-namespace:Xaminals.Controls"
       xmlns:sys="clr-namespace:System;assembly=netstandard"
       xmlns:views="clr-namespace:Xaminals.Views"
       x:Class="Xaminals.AppShell"
       x:Name="shell"
       FlyoutBackgroundImage="photo.jpg"
       FlyoutBackgroundImageAspect="AspectFill"
       FlyoutHeaderBehavior="CollapseOnScroll"
       FlyoutIcon="Assets/Monkey.png">

以上代码适用于 Android,但不适用于 UWP。即使在 UWP 中更改了我的 FlyoutIcon 后,我仍然只能获得默认的汉堡图标。

1 个答案:

答案 0 :(得分:1)

<块引用>

无法在 xamarin 表单 UWP 中更改 shell 页面的汉堡菜单图标

请参考 ShellRenderer 源代码。它尚未为 UWP 平台实现 FlyoutIcon。正如我们所知,Shell 将在 UWP 平台内呈现为 NavigationView。如果我们想更新菜单按钮,我们只需要编辑Icon的{​​{1}} Textblock的内容,并将其插入到UWP PaneToggleButtonStyle文件中。

例如

App.xaml