简体   繁体   中英

How to fix labels not showing up in ListViews?

My issue is when I add in labels to my ListView they wont show. I am binding the labels to objects inside "DummyClass". FirstName, LastName, RepId.

I have done plenty amount of research over this issue and have asked multiple people to help on this subject but nothing enter image description here seems to work.

<StackLayout>
                <ListView  x:Name="listView"
                           HeightRequest="100">
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <ViewCell>
                                <StackLayout>
                                    <Label Text="Hello" 
                                           BackgroundColor="Red"
                                           VerticalOptions="FillAndExpand"/>
                                    <Label Text="Yes"
                                           BackgroundColor="Red"
                                           VerticalOptions="FillAndExpand"/>
                                    <Label Text="Wooohooo"
                                           BackgroundColor="Red"
                                           VerticalOptions="FillAndExpand"/>
                                </StackLayout>
                            </ViewCell>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
            </StackLayout>

I found out what my issue was. It was the ItemSource. My ItemSource was not defined correctly. Fixed all the issues I was having. Thank you all for helping!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM