FlyoutIsPresented is not working

Bhuwan 881 Reputation points
2024-02-21T10:38:03.4133333+00:00

In .NET MAUI, within the AppShell, when 'Shell.NavBarIsVisible' is set to 'False', and a button is clicked on any page, triggering the code 'Shell.Current.FlyoutIsPresented = !Shell.Current.FlyoutIsPresented;' in the code-behind, it does not function as expected on Android. However, it works as intended on iOS. Interestingly, the same implementation in the previous version for Xamarin.Forms was successful. Note: Upon clicking the button, the Hamburger menu does not open. However, after clicking the button for the first time, subsequently clicking any of the tab bar icons does open the menu.

i am downloaded code for this URL -https://github.com/dotnet/maui-samples/tree/main/8.0/Fundamentals/Shell

and added one line in AppShell-'Shell.NavBarIsVisible="False"' added button in CatsPage.xaml file- <StackLayout Padding="10,20,10,0"> <Button Text="Flyout Enable" Clicked="Button_Clicked"/> <CollectionView Margin="20" ItemsSource="{x:Static data:CatData.Cats}" ItemTemplate="{StaticResource AnimalTemplate}" SelectionMode="Single" SelectionChanged="OnCollectionViewSelectionChanged" /> </StackLayout>

button event
private void Button_Clicked(object sender, EventArgs e) { Shell.Current.FlyoutIsPresented = !Shell.Current.FlyoutIsPresented; }

User's image

User's image

Developer technologies | .NET | .NET MAUI
{count} votes

1 answer

Sort by: Most helpful
  1. Bhuwan 881 Reputation points
    2024-02-23T04:43:47.57+00:00

    @Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) I have created a bug in GitHub with this URL - https://github.com/dotnet/maui/issues/20779. As suggested, it has been fixed and updated in the latest release. After updating, it is now working as expected.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.