Use WPF DataGrid to create a specific grid structure

Dec 27, 2012 at 8:25 PM
Edited Dec 28, 2012 at 3:22 PM


I'm new to WPF and XAML, but have done a lot of Windows Forms stuff. Of course, that won't be a ton of help with XAML. :)

I have created a DataGrid that has a fixed number of columns. I've created a WPF user control that has a couple of string properties and an integer property for index, where index will correspond to the column number that the user control should be in. I'm thinking that I will pull data from a database table and bind it to the DataGrid, but I need a XAML structure that supports a scenario in which each row in my datasource is a cell, and not a new row in the grid.

For example, 

1 2 3 4 5

6 7 8 9 10

I'm adding my user control to the grid now, but I'm binding using a generic list. With each list item, a new row is created instead of another cell on the same row. Anyone have ideas on where I might start on a construct like this?



UPDATED: So this is what lack of sleep will do to you...Switched to data table, applied indexes and sorting, problem solved.