Hello. I have this question. Suppose there is a DataGrid that should display data from a table, a two-dimensional array, a list of lists, or a similar structure. In other words, I do not know exactly how many rows and columns in this table. I just need to display a table of arbitrary size in the data grid. How can i do this? All the solutions that I saw provided that I knew the number of columns. I tried to do something
<Grid> <DataGrid Name="MyTableGrid" AutoGenerateColumns="True" > </DataGrid> </Grid> var resultDetails = new List<List<int>> { new List<int> { 1, 1, 1, 1, 1, 1 }, new List<int> { 2, 2, 2, 2, 2, 2 } }; PeriodicTableGrid.ItemsSource = resultDetails; But instead of the contents of the table, I get this:

Is it possible to somehow form a grid so that it displays the contents of the table regardless of its dimension?
List<List<int>>, you would haveList<SomeClass>, it would be much easier. What does your data really mean ? Do you really need an array, and not a more semantic type of string? - VladD