List directory files in a DataGrid

后端 未结 5 1872
悲哀的现实
悲哀的现实 2021-01-22 00:10

I have searched many topics and can\'t find an answer on using the WPF DataGrid to list file name contents from a directory. I am able to output the contents in a <

5条回答
  •  被撕碎了的回忆
    2021-01-22 01:15

    You first have to add Columns in your DataGrid (using VS is pretty simple with the designer) and then you can use something like:

    for (int i = 0; i < Object.Length; i++)
        dataGrid.Rows[i].Cells[0].Value = Object[i];
    

    In this case i'm using Cells[0], but you can specify any cell on your row to put the values.

提交回复
热议问题