Repository navigation
Closed as not planned
Labels
area-controls-shellShell Navigation, Routes, Tabs, Flyoutplatform/androidplatform/ioss/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working
Milestone
Description
Description
I'm using a custom DataTemplate for my Shell items. That works fine for FlyoutItem, whose Icon property I can bind too, but the same trick does not work for MenuItem's IconImageSource property.
Steps to Reproduce
- Create a new MAUI application, using .NET 6.0
- Add an image (
service.png) to theResources/Imagesfolder - Replace AppShell.xaml with the following content:
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
x:Class="MyMAUIApp.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MyMAUIApp"
Shell.FlyoutBehavior="Locked"
FlyoutBackgroundColor="Black"
Shell.BackgroundColor="Black"
FlyoutWidth="80">
<Shell.Resources>
<ResourceDictionary>
<DataTemplate x:Key="IconTemplate" x:DataType="FlyoutItem">
<Grid ColumnDefinitions="*" RowDefinitions="Auto,Auto"
Padding="3,0,2,0"
WidthRequest="{Binding FlyoutWidth, Source={x:Reference Shell}}"
HeightRequest="75">
<Image Grid.Column="0" Grid.Row="0"
Source="{Binding Icon}"
WidthRequest="40"
HeightRequest="40"
Margin="0,12,0,0">
</Image>
<Label Grid.Column="0" Grid.Row="1"
Margin="0,-3,0,0"
Text="{Binding Title}"
TextColor="White"
FontSize="12"
HorizontalOptions="Center"/>
</Grid>
</DataTemplate>
<DataTemplate x:Key="MenuItemTemplate" x:DataType="MenuItem">
<Grid ColumnDefinitions="*" RowDefinitions="Auto,Auto"
Padding="3,0,2,0"
WidthRequest="{Binding FlyoutWidth, Source={x:Reference Shell}}"
HeightRequest="75">
<Image Grid.Column="0" Grid.Row="0"
Source="{Binding IconImageSource}"
WidthRequest="40"
HeightRequest="40"
Margin="0,12,0,0" />
<Label Grid.Column="0" Grid.Row="1"
Margin="0,-3,0,0"
Text="{Binding Text}"
TextColor="White"
FontSize="12"
HorizontalOptions="Center"/>
</Grid>
</DataTemplate>
</ResourceDictionary>
</Shell.Resources>
<MenuItem Text="Text" IconImageSource="service.png" Shell.MenuItemTemplate="{StaticResource MenuItemTemplate}" />
<FlyoutItem Title="Title" Icon="service.png" Shell.ItemTemplate="{StaticResource IconTemplate}">
<ShellContent
Title="Home"
ContentTemplate="{DataTemplate local:MainPage}"
Route="MainPage" />
</FlyoutItem>
</Shell>
- Run the application
If you replace {Binding IconImageSource} with service.png, the icon does show, but I need it to load dynamically from a URL.
Link to public reproduction project repository
https://github.com/Glorfindel83/MAUIBugReports/tree/main/CustomImageMenuItemTemplate
Version with bug
7.0.86
Last version that worked well
Unknown/Other
Affected platforms
iOS, Android
Affected platform versions
iOS 16, Android 33
Did you find any workaround?
Not really; when I replaced the template with one for FlyoutItem, like this:
<DataTemplate x:Key="MenuItemTemplate" x:DataType="FlyoutItem">
<Grid ColumnDefinitions="*" RowDefinitions="Auto,Auto"
Padding="3,0,2,0"
WidthRequest="{Binding FlyoutWidth, Source={x:Reference Shell}}"
HeightRequest="75"
BackgroundColor="{DynamicResource Dark}">
<Image Grid.Column="0" Grid.Row="0"
Source="{Binding Icon}"
WidthRequest="40"
HeightRequest="40"
Margin="0,12,0,0" />
<Label Grid.Column="0" Grid.Row="1"
Margin="0,-3,0,0"
Text="{Binding Title}"
TextColor="White"
FontSize="12"
HorizontalOptions="Center"/>
</Grid>
</DataTemplate>
that worked in Debug builds, but not in Release builds.
I have also tried binding it to a property of the Shell's view model, but to no avail.
Reacted by dainius-r, peruchali and kosaku hayashi
Metadata
Metadata
Assignees
Labels
area-controls-shellShell Navigation, Routes, Tabs, Flyoutplatform/androidplatform/ioss/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working
Activity
[-]Can't use MenuItem's IconImageSource in a template[/-][+]Can't use custom image in a MenuItem template[/+]https://github.com/dotnet/maui/issues/15547
Glorfindel83 commentedon Jun 16, 2023
Reproduction project added
shadowfoxish commentedon Aug 31, 2023
I think the main issue here is that
<MenuItem>is turned into aMenuShellItemand passed into the<Shell.MenuItemTemplate>. So FlyoutItem is definitely not the rightx:DataTypetype for that template.MenuShellItemis not public, so you can't data bind correctly to it, and it seems to hide the IconImageSource property.The only workaround I can think of at the moment is, a sucky one, but if you only have one Menu Item, you can set the icon directly as a string in the Template, rather than try to databind to to the MenuItem.Try usingShellItemas thex:DataTypeand bind your image source toIcon. That might be common enough in between type to make it work.I found this related issue, which was closed because Xamarin. xamarin/Xamarin.Forms#13142
Databindings seem to be handled different in Debug vs Release mode. They seem to be more promiscuous in Debug mode, but in Release mode type/template mismatches will cause crashes.
https://github.com/dotnet/maui/blob/972b15ed45db627596b3ec0dd206e74624d3689f/src/Controls/src/Core/Shell/MenuShellItem.cs
Zhanglirong-Winnie commentedon Jan 24, 2024
Verified this issue with Visual Studio Enterprise 17.9.0 Preview 3. Can repro on android platforms with sample project.

https://github.com/Glorfindel83/MAUIBugReports/tree/main/CustomImageMenuItemTemplate
3 remaining items
tentom commentedon Nov 20, 2024
I seem to have the same issue when I have a binding for the Text proprety as well of the MenuItem
Barry-Theunissen commentedon Feb 3, 2025
Any fix for this yet? I have the same issue
Grzegorz1223 commentedon Feb 12, 2025
ATM there is no way of using MenuItemTemplate with precompiled bindings. Can this be take in account for MAUI as well since the situation is exactly the same? xamarin/Xamarin.Forms#13142
b12kab commentedon Mar 7, 2025
I am in the same place as all of the above people and presumably others just starting to work on .net9. As noted by @Grzegorz1223 the Xamarin issue is the same as this one.
When can MenuShellItem be changed from an internal class to a public one?
KHALED-gtf commentedon Jun 10, 2025
I have got the same issue
sebdevlab commentedon Jul 21, 2025
+1. Also facing this same issue! We want to implement a flyout menu that is not connected to the bottom tabbar. So we can't use FlyoutItems because the ShellContent will interfere with the ShellContent from the tabbar. Therefore using MenuItems but can't set the icons through the IconImageSource binding with the MenuItemTemplate...
sebdevlab commentedon Jul 21, 2025
I've found a solution. In your
Shell.MenuItemTemplateremove thex:DataTypebinding from the DataTemplate. Then for the Source of the Image you can set the Binding toIconinstead of IconImageSource. Removing the DataType will make it possible to set the binding to the Icon attribute of the FlyoutItem instead of the MenuItem. They both are part of the Shell so it will render itkosaku-hayashi commentedon Jun 1, 2026
You can work around this by using the FlyoutContent property to replace the entire Flyout menu section with custom content. You can either write MenuItem elements directly, or use FlyoutContentTemplate to enable compiled bindings.
https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/shell/flyout?view=net-maui-10.0#replace-flyout-content
dotnet-policy-service commentedon Aug 13, 2026
Hi @@Glorfindel83. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.
You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.
This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
dotnet-policy-service commentedon Aug 13, 2026
Hi @Glorfindel83. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.
You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.
This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
kubaflo commentedon Oct 10, 2026
Thank you for taking the time to report this and share the details.
We requested a check on the latest version on August 13, 2026, and there has been no subsequent human follow-up in this thread. We are closing this report as not planned at this time because the requested current-version confirmation has not arrived and we are not scheduling further investigation from this thread.
This is a backlog-prioritization decision, not evidence that the reported behavior is fixed or that the original report lacked value. If the issue remains a blocker on a supported current .NET MAUI version, please comment here with that version and the reproduction result so we can reassess it. An existing sample, attachment, code snippet, or repository test can be reused; a new repository is not required.