Hi,
In my window, I declare and populate an ObservableCollection<Person> _persons; Then I assign it as the DataContext of the window like this: this.DataContext = _persons;
I have a listbox in the window and in XAML I bind it to the collection like below which works well. My question is how do I declaratively set the datacontext in XAML, instead of codebehind? I've played around with <Window.DataContext/> but could get it right.
<ListBox ItemsSource="{Binding}" DisplayMemberPath="FullName"></ListBox>