I've set up my DataContext
like this:
<Window.DataContext>
<c:DownloadManager />
</Window.DataContext>
Where DownloadManager
is Enumerable<DownloadItem>
. Then I set my DataGrid
like this:
<DataGrid Name="dataGrid1" ItemsSource="{Binding Path=/}" ...
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}"
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: 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.
Try ItemsSource="{Binding}"
. It should be enough.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With