xamarin forms listview height
всем доброго времени суток, есть проблема с версткой, есть listview, в нем несколько expander, все работает отлично, но expander при открытии отображается только на высоту страницы телефона, все что ниже не отображается вовсе, сталкивался кто то с подобным?
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="App7.MainPage">
<ListView x:Name="mainListView" HasUnevenRows="True">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<Expander>
<Expander.Header>
<StackLayout>
<Label Text="{Binding title}"/>
<StackLayout Orientation="Horizontal">
<Button Text="Переиминовать группу"/>
<Button Text="Удалить из шаблонов"/>
</StackLayout>
</StackLayout>
</Expander.Header>
<ListView ItemsSource="{Binding exp2s}" HasUnevenRows="True">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<Frame Padding="0">
<Expander Tapped="Expander_Tapped">
<Expander.Header>
<StackLayout>
<StackLayout Orientation="Horizontal">
<StackLayout>
<Label Text="{Binding task}"/>
<Label Text="Ответсвенный:"/>
<Label Text="Контрольная дата:"/>
<Label Text="Особый статус:"/>
</StackLayout>
<StackLayout>
<Label Text="{Binding taskResult}"/>
<Label Text="{Binding otvetstvenniy}"/>
<Label Text="{Binding contrData}"/>
<Label Text="{Binding status}"/>
</StackLayout>
</StackLayout>
<Label Text="Что сделать"/>
<StackLayout Orientation="Horizontal">
<Label Text="{Binding chtoSdelat}" MaxLines="{Binding maxlines}" LineBreakMode="TailTruncation"></Label>
<Label Text=">"/>
</StackLayout>
</StackLayout>
</Expander.Header>
<StackLayout>
<Label Text="Комментарий:"/>
<Label Text="5000 строк"/>
<Label Text="Напоминание"/>
</StackLayout>
</Expander>
</Frame>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Expander>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ContentPage>
Ответы (1 шт):
ListView и ScrollView вместе использовать не стоит, они оба поддерживают прокрутку. нужно использовать либо ListView, либо ScrollView. вложенные StackLayout с различными Orientation нужно заменить на Grid, это повысит быстродействие и упростит схему. Grid сложнее понять, чем StackLayout, и многие его недооценивают, но в данном случае Grid подходит лучше. expander-ы можно заменить на IsVisible. чем проще структура, тем легче с ней работать.
