简体   繁体   English

如何解决未在ListViews中显示的标签?

[英]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". 我将标签绑定到“ DummyClass”内的对象。 FirstName, LastName, RepId. 名字,姓氏,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. 我对此问题进行了大量研究,并请多个人提供有关此主题的帮助,但是似乎没有任何enter image description here工作。

<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. 这是ItemSource。 My ItemSource was not defined correctly. 我的ItemSource定义不正确。 Fixed all the issues I was having. 解决了我遇到的所有问题。 Thank you all for helping! 谢谢大家的帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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