How can a show row number from 1 to so on in a listview in xamarin forms?

六眼飞鱼酱① 提交于 2019-12-11 17:49:25

问题


I have got a requirement where I have to create a listView which adds item number with each item. I have got an idea of putting a number in model of item but I am unable to figure that out.


回答1:


The easiest way should be to add one additional property Index to the ViewModel that is bound to the the ListView.ItemsSource and then simply represent it on the screen.

Alternatively, if there is a need to use an enumerated ListView multiple times you could create a reusable control and move the logic from the ViewModel to the UI layer.

So it all depends on your needs.



来源:https://stackoverflow.com/questions/51335049/how-can-a-show-row-number-from-1-to-so-on-in-a-listview-in-xamarin-forms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!