Bug 27711 - NavigationPage is Not Xaml-Friendly
Summary: NavigationPage is Not Xaml-Friendly
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.5
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-03-05 15:31 UTC by Michael
Modified: 2015-05-19 12:08 UTC (History)
4 users (show)

Tags: xaml navigationpage
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Michael 2015-03-05 15:31:30 UTC
Hello,

I apologize if I am completely misunderstanding/overlooking something here, but it appears that NavigationPage cannot be created with default Xaml markup.  It has a constructor that is  expecting a root page.  It is not possible to define this in Xaml without using a markup extension.

It would be ideal to have a [ContentProperty( "Root" )] set on the NavigationPage type, along with a Root property that works with the PushPage method to set the root of the NavigationPage. Or another mechanism that would allow to define a NavigationPage without having to use a markup extension. :)

Please let me know if there are any questions about this.  And again I apologize if I have totally misunderstood something!

Thank you,
Michael
Comment 1 Rui Marinho 2015-05-19 12:08:18 UTC
Hi Michael, most usecases NavigationPage is just a wrapper for other pages, but you can create it using Xaml 2009 features that Xamarin Forms supports, check this example:

<?xml version="1.0" encoding="UTF-8" ?>
<NavigationPage
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    x:Class="My.Shared.Page">
    <x:Arguments>
        <Page>
            <ScrollView>
                <StackLayout x:Name="layout" Orientation="Vertical" VerticalOptions="Start" HorizontalOptions="Center">  
                <ActivityIndicator x:Name="activity"></ActivityIndicator>                                                   
                </StackLayout>  
            </ScrollView>    
        </Page>    
    </x:Arguments>
</NavigationPage>