Reputation: 9527
Is there an example somewhere of binding, a ListBox
for example, to a directory? I'm guessing this will involve actually binding to something involving FileSystemWatcher
so that the ListBox
is updated accordingly.
Upvotes: 3
Views: 1087
Reputation: 13775
I don't know that you can bind to a directory. However, you can bind to an ObserveableCollection
and then use the FileSystemWatcher
's events to update that ObserveableCollection
, which in turn will update your listbox.
Upvotes: 5
Reputation: 3777
If you are using .NET 4 you can use new Directory.EnumurateFiles.
as it returns IEnumerable you might need to wrap it up with ObservableCollection to make it WPF MVVM friendly
Upvotes: 2