WPF Binding Path=/ not working?

Posted by Mark on Stack Overflow See other posts from Stack Overflow or by Mark
Published on 2010-05-06T20:47:21Z Indexed on 2010/05/06 22:08 UTC
Read the original article Hit count: 184

Filed under:
|
|
|

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.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about .net-4.0