Two way binding between DataGrid and an array

后端 未结 3 2099
心在旅途
心在旅途 2020-12-19 08:24

I have an an array called:

string[,] TableData;

Can I link its content with a DataGrid control using binding?

If possible, I would

3条回答
  •  我在风中等你
    2020-12-19 08:55

    See this question: How to populate a WPF grid based on a 2-dimensional array

    You can use this control called DataGrid2D (source code here). To use it just add a reference to DataGrid2DLibrary.dll, add this namespace

    xmlns:dg2d="clr-namespace:DataGrid2DLibrary;assembly=DataGrid2DLibrary"
    

    and then create a DataGrid2D and bind it to your IList, 2D array or 1D array like this

    
    

    The users will be able to edit the data and changes made in the DataGrid will be reflected in the 2D Array

提交回复
热议问题