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 <
You can create DataGrid with one column:
and fill it in your code like this:
myDataGrid.ItemsSource = new DirectoryInfo(path).GetFiles();
By setting ItemsSource to FileInfo[] you have option to create other columns bound to other properties for FileInfo class. This DataGrid will work with any IEnumerable assigned to ItemsSource. If it won't be a string already then ToString() will be called