This is explanation NavigationPage in xaml implement.
** How to conver below code to xaml **
...
MainPage = new NavigationPage ( new CustomerPage() );
...
This is explanation NavigationPage in xaml implement.
** How to conver below code to xaml **
...
MainPage = new NavigationPage ( new CustomerPage() );
...
<?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:local="clr-namespace:App1.Pages" | |
x:Class="App1.CustomerPage"> | |
<Label Text="Say something here..."/> | |
</ContentPage> |
using System; | |
using System.Collections.Generic; | |
using Xamarin.Forms; | |
namespace App1 | |
{ | |
public partial class CustomerNavigationPage : NavigationPage | |
{ | |
public CustomerNavigationPage() : base(new CustomerPage()) { } | |
} | |
public partial class CustomerPage : ContentPage | |
{ | |
public CustomerPage() | |
{ | |
InitializeComponent(); | |
} | |
} | |
} |
<?xml version="1.0" encoding="utf-8" ?> | |
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms" | |
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | |
xmlns:local="clr-namespace:App1" | |
x:Class="App1.MainPage"> | |
<local:CustomerNavigationPage | |
Title="Navigation Title" | |
BackgroundColor="#f0f0f0"/> | |
</TabbedPage> |
Hi,
Thank you for the proposition but I just tried it and it does not work here.
I get this error message.
Error XLS0503 A value of type 'NavigationPickerNavigationPage' cannot be added to a collection or dictionary of type 'IList`1'. FormsControls MainPage.xaml 11
My code (NavigationPicker.xaml.cs) :
It is in the same namespace as the NavigationPicker ContentPage so in my MainPage which is a CarouselPage, I should be able to add the NavigationPickerNavigationPage but it doesn't show in IntelliSense list at all.
Compiling works. Application run but it is simply ignored. The code does not know of this NavigationPickerNavigationPage class.
Just see the screenshot below:
One thing I find weird is using the partial keyword where there is no other part to that NavigationPage derived class. You didn't seem to have made a XAML view to it. Could it be the reason why it does not work ?
I also tried and it does not make any difference.
Kind regards