Hello,
I can reproduce this issue in windows platform. Please report this issue at MAUI GitHub repo.
Here is a workaround. You can remove this <ShellContent x:Name="Profile" IsEnabled="True" Title="Profile" IsVisible="True" ContentTemplate="{DataTemplate views:Profile}" />
code in your AppShell.xaml,
Then you can add Button to <Shell.FlyoutHeader>
or <Shell.FlyoutFooter>
, I add button to the <Shell.FlyoutHeader>
for testing. When I click the login button, Profile button will appear.
<Shell.FlyoutHeader>
<StackLayout>
<Button Text="login" Clicked="btnLogin_Clicked"></Button>
<Button Text="Profile" x:Name="Profile" TextColor="Black" Clicked="Profile_Clicked" Background="Transparent" Margin="10,0"></Button>
</StackLayout>
</Shell.FlyoutHeader>
When you click the Profile button, Profile page will appear by await Shell.Current.GoToAsync("/Profile");
like following code.
private async void btnLogin_Clicked(object sender, EventArgs e)
{
//simulation of login. I did not build full function. this is for testing only.
// EnableShellItemsAfterLogin();
Profile.IsVisible = true;
}
private async void Profile_Clicked(object sender, EventArgs e)
{
await Shell.Current.GoToAsync("/Profile");
}
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.