Solution for FlyoutPage
The Flyout of the FlyoutPage
is of type ContentPage
and thus the icon should be set there instead:
<ContentPage
IconImageSource="custom_menu_icon.png" />
</ContentPage>
You can also define it in the Styles.xaml
and assign the style to the page:
<Style TargetType="ContentPage" x:Key="FlyoutStyle">
<Setter Property="IconImageSource" Value="custom_menu_icon.png" />
</Style>
<ContentPage
Style="{StaticResource FlyoutStyle}" />
</ContentPage>
See also: https://learn.microsoft.com/dotnet/maui/user-interface/pages/flyoutpage?view=net-maui-7.0#create-a-flyoutpage
This assumes that you're using the FlyoutPage
and not Shell
.
Solution for Shell
In case you're using Shell, you can define the style as follows:
<Style TargetType="Shell" ApplyToDerivedTypes="True">
<!-- skipping existing setters here -->
<Setter Property="Shell.FlyoutIcon" Value="custom_menu_icon.png" />
</Style>
See more: https://learn.microsoft.com/dotnet/maui/fundamentals/shell/flyout?view=net-maui-7.0#flyout-icon