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 <
DataGrid
Instead of:
object[] AllFiles = new DirectoryInfo(path).GetFiles().ToArray();
use
List AllFiles = new DirectoryInfo(path).GetFiles().ToList(); MyDataGrid.ItemSource = Allfiles;
This will automatically bind the files to the DataGrid.