UI : Title bar has a wrong position

Hello,

I make a Xamarin.Forms app, and i've encountered a UI problem.
The Title Bar has a wrong position in my page and i don't understand why ... it's probably very simple ...
If somebody knows and can help me, it'll be very nice.

Here's the XAML code and a screenshot of the result on iOS.

Thanks,
Simon

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage 
    xmlns="http://xamarin.com/schemas/2014/forms" 
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
    x:Class="Views.TaskDetailsPage" Title="Détails">

    <ContentPage.Content>
        <StackLayout>
            ...
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

Posts

  • PaulDistonPaulDiston USUniversity ✭✭✭✭

    Hi,

    Would you be able to share your AppDelegate and App class (where you set the MainPage)?

    Thanks

    Paul Diston

  • SimonDelliseSimonDellise BEMember ✭✭
    edited March 2015

    Hi ! Sure, here's all the code.

    App class :
    public App () { // Depearture of the Application. MainPage = new NavigationPage (new LoginPage { }); }

    LoginPage :
    await Navigation.PushModalAsync (new NavigationPage (new HomePage ()));

    HomePage is a tabbed page with a "link" to TasksHomePage :
    <TabbedPage.Children> <me:TasksHomePage /> <me:LoginPage /> <!-- To change --> </TabbedPage.Children>

    TaskHomePage :
    this.TasksList.ItemSelected += async (sender, e) => await Navigation.PushAsync (new NavigationPage (new TaskDetailsPage ((Task)e.SelectedItem)));


    I haven't changed anything in the AppDelegate.cs :
    [Register ("AppDelegate")] public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate { public override bool FinishedLaunching (UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.Init (); LoadApplication (new App ()); return base.FinishedLaunching (app, options); } }

  • PaulDistonPaulDiston USUniversity ✭✭✭✭

    Hi,

    I think what is happening is that you are nesting a NavigationPage inside another NavigationPage.

    Instead of :-

    await Navigation.PushModalAsync (new NavigationPage (new HomePage ()));

    I think it should be :-

    await Navigation.PushModalAsync (new HomePage ());

    Hope this helps.

    Paul Diston

  • SimonDelliseSimonDellise BEMember ✭✭
    edited March 2015

    Oh! It's exact, I'm creating 3 new NavigationPage and this is the origin of my problem. What a silly question ...
    Thanks for your time, Paul!

    Simon.

Sign In or Register to comment.