[英]How to Customize MasterDetailPage Of a xamarin forms app on UWP?
我正在使用xamaring表單構建應用程序,但是無法在UWP中更改母版頁眉,它在android上工作正常,但在uwp上工作正常。
這是屏幕截圖:
我要做的是更改“菜單”欄的顏色。
這是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>
為了使我能夠正常工作,出於某種原因,我不得不在隱藏的代碼中進行設置:
if (Device.RuntimePlatform == Device.UWP) {
BarBackgroundColor = Colour.LighterGray;
BarTextColor = Colour.DarkGray;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.