我已经设置了我的的DataContext
是这样的:
I've set up my DataContext
like this:
<Window.DataContext>
<c:DownloadManager />
</Window.DataContext>
其中,下载管理器
是可枚举&LT; DownloadItem&GT;
。然后,我把我的的DataGrid
是这样的:
Where DownloadManager
is Enumerable<DownloadItem>
. Then I set my DataGrid
like this:
<DataGrid Name="dataGrid1" ItemsSource="{Binding Path=/}" ...
所以,它应该列出所有DownloadItems,对不对?所以,我应该能够把我列这样的:
So that it should list all the DownloadItems, right? So I should be able to set my columns like:
<DataGridTextColumn Binding="{Binding Path=Uri, Mode=OneWay}"
其中,乌里
是属性的 DownloadItem
。但它似乎并不喜欢这样。在可视化的属性编辑器,它不承认乌里
是一个有效的属性,所以我猜,我做错了什么。
Where Uri
is a property of the DownloadItem
. But it doesn't seem to like this. In the visual property editor, it doesn't recognize Uri
is a valid property, so I'm guessing I'm doing something wrong.
这是工作前,当我有数据网格绑定到值
,但后来我把那个枚举出的下载管理器
键,使自己枚举。我该如何解决这个问题?
It was working before, when I had the data grid binding to Values
, but then I took that enumerable out of the DownloadManager
and made itself enumerable. How do I fix this?
PS:所谓不工作我的意思是没有列出任何项目。我已经添加了一些对DM的构造,所以它不应该是空的。
PS: By "doesn't work" I mean it doesn't list any items. I've added some to the constructor of the DM, so it shouldn't be empty.
推荐答案
尝试的ItemsSource ={结合}
。它应该是足够的。
Try ItemsSource="{Binding}"
. It should be enough.
相关推荐
最新文章