Great article: DataContext vs ItemsSource (in Binding case)
The difference is that when using DataContext, it means that you bind the owner object of DataContext with the reference, which is DataContext pointed to. So, it some cases such as DataGrid or ListBox. We use ItemSource instead when we're talking about data in each row, not the DataGrid itself. On the other hand, we use DataContext to set binding from source ojbect to DataGrid directly.
No comments:
Post a Comment