Here is my problem:
I have created a user control that consists of a DataGrid. I don't know how many columns or rows the DataGrid will have since this is up to the user at run time. The column Headers are also up to the user.
I created a class (say CustomData) that consists of an array of KeyValuePairs<string,string>, where the key is the Column Header and the Value is... well the value. I then create an ObservableCollection<CustomData> Data, that is basically a collection
of arrays of KeyValuePairs. Each entry (array) in this collection is essentially a row that should appear in the DataGrid.
The problem comes in when I try to bind the data to my DataGrid. I can create the columns of the DataGrid no problem by taking the first array of the collection (Data), iterating through the array and creating a column for every item in it. But I cannot
get the binding to work. If I bind the columns using the "Value" property of Data then every row below that first row has the exact same data as Data. If I try to use DataContext, I get the right number of rows in my DataGrid, but they are
Is there any way of getting this approach to work? I think when I use DataContext I get blank rows because the DataGrid has no idea of the items inside the arr
View Complete Post