我有我的項目出了問題,我使用MasterDetailPage
用一個簡單的ListView
和使用本地命名空間來調用另一個頁面的他體內有ListView
過了,有THIS結果,問題是,工具欄和列表視圖之間的空白,但如果我嘗試瀏覽這個很頁面不使用MasterDetailPage,列表視圖工作正常,沒有這個空白,並且您檢查HERE如何擺脫MasterDetailPage空白窗體Xamarin
應用。 cs導航到MenuPage.Xaml
MainPage = new NavigationPage(new MenuPage());
MenuPage.XAML
`<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Gone.MenuPage"
xmlns:local="clr-namespace:Gone;assembly=Gone">
<MasterDetailPage.Master>
<ContentPage Title="Menu">
<ListView BackgroundColor="Transparent"
SeparatorVisibility="Default"
HasUnevenRows="True"
x:Name="listView">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Padding="2" Orientation="Horizontal">
<Image Aspect="Fill" WidthRequest="60" HeightRequest="60" Source="{Binding image}"/>
<StackLayout Padding="5,18,0,0" Orientation="Vertical">
<Label TextColor="Black" Text="{Binding title}"/>
</StackLayout>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ContentPage>
</MasterDetailPage.Master>
<MasterDetailPage.Detail>
<local:MainPage/>
</MasterDetailPage.Detail>
</MasterDetailPage>`
MainPage.xaml中
<ListView BackgroundColor="Transparent"
SeparatorVisibility="Default"
HasUnevenRows="True"
x:Name="listView">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Orientation="Horizontal">
<Image Aspect="AspectFill" WidthRequest="130" HeightRequest="130" Source="{Binding image}"/>
<StackLayout Padding="20" Orientation="Vertical">
<Label LineBreakMode="WordWrap" FontSize="17" TextColor="#4CAF50" Text="{Binding title}"/>
<Label FontAttributes="Bold" TextColor="#2962FF" Text="{Binding price}"/>
<Label TextColor="#455A64" Text="{Binding date}"/>
</StackLayout>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>