微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决无法更改 xamarin 表单 UWP 中 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 后,我仍然只能获得认的汉堡图标。

解决方法

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

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

例如

App.xaml

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。