While working in WPF i have the need for a Dynamic Grid. By this i mean a grid that contains only one kind of object, has a template for that object etc. But unlike a similar ItemsControl like a Listbox, i want the grid to be given a Maximum Columns property. This should act as a delimiter which will then calculate the number of rows needed based on the number of objects within the grid. To do this, i thought of inherriting a Grid to make use of its Row and Column properties, but i have a problem... I dont know how to implement an ItemsSource property outside of inherriting the ItemsSource from an ItemsControl...

so my question comes in two parts...

1. Am i pursuing this the right way? should i be inherriting ItemsControl and trying to re-implement the Grid behavior
2. if this is the right way to do it, how do i implement an ItemsSource property with its corresponding ItemTemplate