Почему Listview слишком долго скрывает текст? - PullRequest
0 голосов
/ 07 июня 2019

Listview скрывает длинный текст.

Visual Studio, Xamarin-Forms

ListView x:Name="listView" Refreshing="Refresh">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell>
                        <StackLayout Margin="20,0,0,0" HorizontalOptions="FillAndExpand" Orientation="Horizontal">
<Label Text="Text and text"  FontAttributes="Bold" VerticalTextAlignment="Start" HorizontalOptions="StartAndExpand" />
<Label Text="Text text text text Text text text textText text text textText text text textText text text textText text text textText text text textText text text textText text text text " />
                        </StackLayout>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
</ListView>

Единственный выход, который я нашел, это RowHeight = 70 Но я не люблю RowHeight = 70, потому чтовезде текст разной длины

1 Ответ

1 голос
/ 07 июня 2019

Необходимо установить для свойства HasUnevenRows значение True и разрешить сброс свойства RowHeight .Также установите LineBreakMode для метки

<ListView ItemsSource="{Binding List}" HasUnevenRows="True" SeparatorVisibility="None">
    <ListView.ItemTemplate>
        <DataTemplate>
            <ViewCell>
                <Grid>
                   <Label LineBreakMode="WordWrap"/>
                </Grid>
            </ViewCell>
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...