Reputation: 1237
I'm working with a CollectionView with a grid items layout. I would like to know if there's a way to show like empty "squares" (boxView/absoluteLayout...) depending on a minimum number of a source items (binding it using MVVM).
I want something like this:
The minimum number would be 14, my items source has a length of 8, I add 6 "empty squares".
Is it possible to do something like this easily?
Upvotes: 0
Views: 325
Reputation: 56
You need two DataTemplates: one for the monkeys, the other for the empty box.
Make an interface ISquare, and implement it in a MonkeySquare and and EmptySquare.
Make the binded List of type ISquare and add 8 MonkeySquares and 6 EmptySquares.
In your Xaml make a DataTemplateSelector where you check if its the Cell is a MonkeySquare or a EmptySquare and return the belonging DataTemplate. For more information regarding DataTemplateSelectors visit the official doc.
Upvotes: 1