Reputation: 4209
Im trying to make the children's game: memory in wpf, i have a list of "Tile" which has an image on them. I want to lay the Tiles out in my Board (also a class with a list of Tile). I need to make the control for layout and then lay it out in e.g. a 4 x 4 matrix.
How to I bind my List to an amount of controls (maybe buttons?) and spread them out on my board?
Upvotes: 1
Views: 70
Reputation: 184516
You can use an ItemsControl
, bind its ItemsSource
to your list, make an ItemTemlate
which contains a Button and set the ItemsPanel
to something like a UniformGrid
or a WrapPanel
.
Upvotes: 1