Take the 2-minute tour ×

I have an one dementional ObservableCollection. How can I display it as a multi-dimentional collection (Matrix)?

E.g: I have list of images (urls) I want to diplay it so there would be three images in a row and as many rows as count/3 will be equal to.

I found how I can bound two dementional list to a grid, but nothing like I want.

Is this is possible?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Yeah you can by overriding the ItemsPanel for your ItemsControl like this -

         <UniformGrid Rows="3" Columns="3"/>
share|improve this answer
Ok, but how it will know how many items in a row and how many rows just by binding? or I need manually initialize all the items...? –  Alex Kapustian Oct 14 '12 at 18:24
Instead use UniformGrid and specify the number of rows and columns as per your need. See the updated answer. –  Rohit Vats Oct 14 '12 at 18:27
ok its better, but still the number of rows is dynamic it changes... –  Alex Kapustian Oct 14 '12 at 18:29
So, don't set the Row field. It will be set dynamically based on the number of items in your collection. –  Rohit Vats Oct 14 '12 at 18:31
Say if you have 24 items then it will automatically create 8 rows of 3 columns each. –  Rohit Vats Oct 14 '12 at 18:31

Your Answer


