I am working on Xamarin.Forms.
When I created blank Xamarin.Forms project there are four project created in one solution, one for iOS, one for Android, one for Windows and one is the Portable project (Common Project).
I add one XAML form named "Page2.XAML" with this code:
<?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="Rutul_App.Page2"
Title="aaaa">
<ContentPage.Content>
<StackLayout>
<Label Text="ABC" HorizontalOptions="Center"/>
</StackLayout>
</ContentPage.Content>
</ContentPage>
and in the code behind file:
namespace Rutul_App
{
public partial class Page2 : ContentPage
{
public Page2()
{
InitializeComponent();
}
}
}
In App.cs page I have added:
public App()
{
// The root page of your application
MainPage = new NavigationPage(new Page2());
}
Problem :
My problem is that the title and the BackGroundImage don't display. There are so many property that doesn't work.
My page is inherit form ContentPage but I can't access property of the ContentPage class. Properties are public.
Why is my title not being displayed?
You can define the page as NavigationPage in App.xaml.cs, without declaring NavigationPage in the xaml file, i.e. like so in App.xaml.cs:
InitializeComponent();
MainPage = new NavigationPage(new Page2());
Try
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Rutul_App.Page2"
Title="aaaa" NavigationPage.HasNavigationBar="True">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With