Open sandeshkarki55 opened 6 months ago
Verified this issue with Visual Studio 17.10.0 Preview 1. Can repro on Android platform.
Workaround:
Create custom ShellRenderer:
class CustomShellHandler : ShellRenderer
{
#if ANDROID
protected override IShellToolbarTracker CreateTrackerForToolbar(AToolbar toolbar)
{
return new CustomShellToolbarTracker(this, toolbar, ((IShellContext)this).CurrentDrawerLayout);
}
#endif
}
Create CustomShellToolbarTracker class and override UpdateToolbarItems with the following code. This removes any duplicate search handler menu item.
#if ANDROID
class CustomShellToolbarTracker(IShellContext shellContext, AToolbar toolbar, DrawerLayout drawerLayout) : ShellToolbarTracker(shellContext, toolbar, drawerLayout)
{
protected override void UpdateToolbarItems(AToolbar toolbar, Page page)
{
// hacky way to remove the duplicate search icon in the toolbar
var menu = toolbar.Menu;
var menuSize = menu.Size();
for (var i = 0; i < menuSize; i++)
{
var menuItem = menu.GetItem(i);
if (menuItem != null && menuItem.ActionView is ShellSearchView)
{
menu.RemoveItem(menuItem.ItemId);
}
}
base.UpdateToolbarItems(toolbar, page);
}
}
#endif
This should fix it.
Description
Issue #7184 is back on the latest MAUI version(8.0.7).
Steps to Reproduce
Link to public reproduction project repository
No response
Version with bug
8.0.3 GA
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
No
Relevant log output
No response