question

StefanoM-9408 avatar image
0 Votes"
StefanoM-9408 asked ColeXia-MSFT answered

Group multiple objects into one in a collectionView

I have a collectionView with some elements inside it, which have a DateTime property. The graphic of each element is defined within the DataTemplate, but I would like that when there are multiple elements with the exact same DateTime property, they would be 'grouped' into a single object in the graphic

My collectionview already has groups, so what could be the right solution?
NOW:
Now
LATER:
Later


dotnet-xamarinforms
now.jpg (56.6 KiB)
later.jpg (49.6 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ColeXia-MSFT avatar image
0 Votes"
ColeXia-MSFT answered

Hello,

Welcome to Microsoft Q&A!

  • Group your list according DateTime , and put them together ,then you'll get a grouped list which contains the same DateTime items , refer to the code .

  • Set Bindable Layouts(e.g StackLayout) as DataTemplate of CollecitonView .

  • Customize DataTemplate inside Bindable Layouts .

  • Create correct binding on every control and then populate the data .


If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.





5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.