0
votes

I am new to Xamarin and been working on using a MasterDetailPage that I want to be used in all my pages with the menu and title. Because of this I was thinking the best way to complete this was to use the app.xaml resources section. I have the color working but I am not getting the text and also need to add png logo image file.

Is this the best way to complete something like this or is there a better way?

<Application.Resources>
    <ResourceDictionary>
        <Color x:Key="UchBlueColor">#243359</Color>
    </ResourceDictionary>
    <Style TargetType="NavigationPage">
        <Setter Property="BarBackgroundColor" Value="{StaticResource UchBlueColor}"></Setter>
        <Setter Property="BarTextColor" Value="White"></Setter>
        <Setter Property="Title" Value="App Name"></Setter>
    </Style>
</Application.Resources>

MainPage.xaml

<MasterDetailPage.Detail>
    <NavigationPage>
        <x:Arguments>
            <pages:HomePage />
        </x:Arguments>
    </NavigationPage>
</MasterDetailPage.Detail>

homePage.xaml

 <ContentPage.Content Padding="0" Title="Browse">
1

1 Answers

0
votes

Technically Title is a feature of ContentPage and while NavigationPage does have this property it is essentially assigned to something else as soon as any ContentPage is loaded which is almost the same as always. So probably a good idea is to use the ContentPage to define the Title.