BookLibrary sample. BookView. DataContext.

Jun 13, 2014 at 5:56 PM
I'm looking at the WPF Application Framework (WAF) BookLibrary sample application. The BookView UserControl binds to properties of Book, e.g., 'Text="{Binding Book.Title'. Where does the app set the UserControl's DataContext? Does the UserControl inherit a DataContext from a higher-level element? Where is the Book property?

Jun 14, 2014 at 7:35 PM
The DataContext of the BookView is the BookViewModel. The ViewModel is responsible to set the DataContext of the View with itself. Therefore, the UserControl implements the IView interface which defines just the DataContext property.
Marked as answer by user329 on 6/16/2014 at 8:36 AM