GridView- binding to groups of different ViewModels? (Combining Images and Text articles)

前端 未结 1 663
予麋鹿
予麋鹿 2021-01-25 21:12

I\'m tying to figure out how to use the GridView with different classes for groups. In the GridApp template everything inherits from SampleDataCommon, do you always have to inh

1条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-25 21:19

    You can bind to any class type. I would suggest that they implement a common interface or class. If they cannot, then grouping them just does not make sense. You can display the items within the group by using a DataTemplateSelector. Here is a very simple example and a more complex sample

    0 讨论(0)
提交回复
热议问题