Modal Popup not showing Navigation Bar

JassimRahmaJassimRahma USMember ✭✭✭

Hi,

Referring to this thread:

https://forums.xamarin.com/discussion/comment/370580#Comment_370580

when I changed from:

Navigation.PushModalAsync(new NavigationPage(new Signin())
{
    BarBackgroundColor = Color.White,
    BarTextColor = Color.Black
});

to:

await Navigation.PushModalAsync(new Signin());

now the popup is not showing the title bar

How can I fix this please?

Thanks,
Jassim

Best Answer

Answers

  • AsurAsur USMember ✭✭✭

    Modal pages are not traditional Navigation pages as they can't have a back button so you can not set a navigation bar in modal pages as that goes against it's purpose .
    Modal pages are not supposed to be backed from unless it's purpose is solved.
    So either use simple navigation with pushAsync or if you want title in modal pages create a view yourself .

  • JassimRahmaJassimRahma USMember ✭✭✭

    I tried the TitleView but nothing is shown either. Below is my XAML and I am showing the page using:

    Navigation.PushModalAsync(new Signin());

    My contractor:

    public Signin ()
    {
        InitializeComponent ();
    }
    

    My XAML:

    <?xml version="1.0" encoding="utf-8" ?>
    <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
                 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                 xmlns:SyncfusionInputLayout="clr-namespace:Syncfusion.XForms.TextInputLayout;assembly=Syncfusion.Core.XForms"
                 xmlns:SyncfusionBusyIndicator="clr-namespace:Syncfusion.SfBusyIndicator.XForms;assembly=Syncfusion.SfBusyIndicator.XForms"
                 Padding="25"
                 x:Class="Zeera.Signin">
        <NavigationPage.TitleView>
            <StackLayout Orientation="Horizontal">
                <Label Text="Sign in" HorizontalOptions="Start" VerticalOptions="CenterAndExpand" />
                <Image x:Name="ImageSigninTitleBarClose" Source="close.png" HorizontalOptions="End" VerticalOptions="CenterAndExpand">
                    <Image.GestureRecognizers>
                        <TapGestureRecognizer Tapped="ImageSigninTitleBarCloseTapped" NumberOfTapsRequired="1" />
                    </Image.GestureRecognizers>
                </Image>
            </StackLayout>
        </NavigationPage.TitleView>
        <ContentPage.Content>
            <ScrollView>
                <StackLayout>
                    <SyncfusionInputLayout:SfTextInputLayout Hint="Email Address" ContainerType="Outlined">
                        <Entry x:Name="TextBoxSigninEmailAddress" Keyboard="Email" HorizontalTextAlignment="Center" />
                    </SyncfusionInputLayout:SfTextInputLayout>
    
                    <SyncfusionInputLayout:SfTextInputLayout Hint="Password" EnablePasswordVisibilityToggle="True" ContainerType="Outlined">
                        <Entry x:Name="TextBoxSigninPassword" IsPassword="True" HorizontalTextAlignment="Center" />
                    </SyncfusionInputLayout:SfTextInputLayout>
    
                    <SyncfusionBusyIndicator:SfBusyIndicator x:Name="BusyIndicatorSignin" AnimationType="SingleCircle" IsBusy="True" IsVisible="False" WidthRequest="40" HeightRequest="40" ViewBoxWidth="30" ViewBoxHeight="30" TextColor="Blue" />
                    <Button x:Name="ButtonSignin"  Text="Sign in" Clicked="ButtonSignin_Clicked" />
                    <Button x:Name="ButtonForgotPassword" Text="Forgot Password" />
                    <Button x:Name="ButtonGoToSignup"  Text="New User?" Clicked="ButtonGoToSignup_Clicked" />
                </StackLayout>
            </ScrollView>
        </ContentPage.Content>
    </ContentPage>
    
  • JohnHardmanJohnHardman GBUniversity mod

    @JassimRahma said:
    I tried the TitleView but nothing is shown either

    It's not the Navigation.TitleView that you use. Move the StackLayout that you currently have in the Navigation.TitleView to inside the StackLayout that you have in the ScrollView.

  • JassimRahmaJassimRahma USMember ✭✭✭

    but this means it's just a normal content within the ContentPage.

    then what's the purpose of TitleView if I cannot use it?

  • JoeMankeJoeManke USMember ✭✭✭✭✭

    The TitleView goes in the TitleBar and you are doing everything in your power to not show the TitleBar. Why are you surprised?

Sign In or Register to comment.