Вопрос

I have a data bound ListView that uses a rather strange heights for every ListViewItem after I start using an ItemTemplate.

        <ListView ItemsSource="{Binding Path=AllTvShows}">
            <ListView.ItemTemplate>
                <DataTemplate>
                        <Label FontStretch="Normal" VerticalAlignment="Center" Content="{Binding Path=Name}"/>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>

This is how it looks like:

enter image description here

Without the ItemTemplate the labels have the normal height (more adjacent). How should I specify the Label so that it would render normal?

Это было полезно?

Решение

Use a TextBlock instead of a Label:

<ListView ItemsSource="{Binding Path=AllTvShows}">
    <ListView.ItemTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding Path=Name}"/>
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top