2017-06-28 2 views
1

Je construis une application utilisant des formes de xamaring mais je ne peux pas changer l'en-tête de la page maître dans UWP, cela fonctionne bien sur android mais pas uwp.Comment personnaliser MasterDetailPage d'une application de formulaires xamarin sur UWP?

Voici une capture d'écran:

enter image description here

ce que je veux faire est de changer la couleur de la barre « Menu ».

ici est le code XAML:

<MasterDetailPage.Master> 
     <ContentPage Title="Menu" BackgroundColor="Red"> 

      <StackLayout Orientation="Vertical"> 
       <StackLayout BackgroundColor="#e74c3c" HeightRequest="60"> 
        <Label Text="SomeText" 
         FontSize="20" 
         VerticalOptions="CenterAndExpand" 
         TextColor="White" 
         HorizontalOptions="Center" /> 

       </StackLayout> 


       <ListView x:Name="NavigationListView" 
        RowHeight="60" 
        SeparatorVisibility="None" 
        BackgroundColor="#e8e8e8" 
        ItemSelected="NavigationListView_ItemSelected"> 

        <ListView.ItemTemplate> 
         <DataTemplate> 
          <ViewCell> 
           <StackLayout VerticalOptions="FillAndExpand" 
            Orientation="Horizontal" 
            Padding="20,10,0,10" 
            Spacing="20"> 

            <Image Source="{Binding Icon}" 
            WidthRequest="40" 
            HeightRequest="40" 
            VerticalOptions="Center"/> 

            <Label Text="{Binding Title}" 
            FontSize="Medium" 
            VerticalOptions="Center" 
            TextColor="Black"/> 

           </StackLayout> 
          </ViewCell> 
         </DataTemplate> 
        </ListView.ItemTemplate> 
       </ListView> 
      </StackLayout> 
     </ContentPage> 
</MasterDetailPage.Master> 

<MasterDetailPage.Detail> 
    <Views:MainPage /> 
</MasterDetailPage.Detail> 

Répondre

1

En fait, la couleur de la barre "Menu" que votre mentionné est BarBackgroundColor. Ainsi, vous pouvez définir BarBackgroundColor pour l'instance NavigationPage.

<MasterDetailPage.Detail> 
    <NavigationPage BarBackgroundColor="PowderBlue"> 
    <x:Arguments> 
     <pages:MasterDetailPageHomeDetail /> 
    </x:Arguments> 
    </NavigationPage> 
</MasterDetailPage.Detail> 

enter image description here