내가 내 프로젝트에 문제가있는 양식, 나는 간단한 ListView
로 MasterDetailPage
을 사용하고 너무 ListView
와 그 안에 다른 페이지를 호출하는 로컬 네임 스페이스를 사용하고, THIS을 가지고있어 결과, 문제는 툴바와 listview 사이의 공백이지만,이 아주 빈 페이지없이 MasterDetailPage를 사용하지 않고 탐색하려고하면 listview는이 공백없이 잘 작동하고 확인할 수 있습니다. HEREMasterDetailPage 빈 공간을 제거하는 방법을 자 마린은
응용 프로그램. 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>