Two way binding between DataGrid and an array

后端 未结 3 2100
心在旅途
心在旅途 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 09:00

    The easiest way should be to use the build in WPF Datagrid and project your Array to a View class which will be bound.

    Do you want your users to be able to add rows? If yes binding to an array is not possible because you can't add rows.

    If you have any number of columns you should be able to project your array to a dynamic object and set the AutoGenerateColumns property of the datagrid to true. Do your columns have names?

提交回复
热议问题