0

I'm fresh new to WPF, and I've been trying to populate a DataGrid, but it shows no values...

As you can see: http://i.epvpimg.com/EJ0Bh.png

Code:

List<FileI> files = new List<FileI>();
foreach (string file in Directory.GetFiles("profileSettings"))
{
    files.Add(new FilI( { fileName = file, fileSize = new FileInfo(file).Length }));
}

dgFilesToExtract.ItemsSource = files;

I checked the folder, there are 2 files, and I placed a BP before the ItemsSource property is set, and the list has items.

What am I doing wrong?

Thanks in advance

4

4 回答 4

2

您的文件类仅包含字段,但您只能绑定到属性。阅读文档

于 2013-09-09T18:35:24.380 回答
1

在你的File类中定义变量的属性并AutogenerateColumns = true在你的数据网格上设置

于 2013-09-09T18:33:25.033 回答
0

看起来您正在ItemsSource代码中设置网格的属性并将其绑定在 XAML 中尝试删除 XAML 中的绑定语句。

于 2013-09-09T18:36:07.577 回答
0

关于模糊字体问题。有很多关于这个的话题看看这个

于 2013-09-10T06:03:22.140 回答