It is necessary to fill dataGrid with a two-dimensional array of lines. and everything would be simple if it were not for the pattern.

I will listen to all the PS suggestions if, as a result of the implementation, it will be possible to also name the header of columns to be finally your top

    1 answer 1

    I advise you to use the Gu.Wpf.DataGrid2D package in which you can set headers for columns.

    You can use NuGet for installation.

     Install-Package Gu.Wpf.DataGrid2D 

    Usage example

     xmlns:dataGrid2D="http://gu.se/DataGrid2D" 

    and

     <DataGrid dataGrid2D:ItemsSource.Array2D="{Binding Data2D}" dataGrid2D:ItemsSource.ColumnHeadersSource="{Binding ColumnHeaders}" dataGrid2D:ItemsSource.RowHeadersSource="{Binding RowHeaders}" /> 
    • but how to bind the array itself, I did not understand - Alexandr
    • @AlexandrAlexandr did you follow the link to the githab page? there are examples - user227049
    • and the problem is there all the same. You can create a new array with new sizes, but it will not appear on the form - Alexandr
    • @AlexandrAlexandr not sure what I understand the problem. Could we continue the discussion of finding a solution in the chat ? in my opinion it will be much faster, just make a ping when you have time. - user227049