Wiring up the customer list box
Now, we need to make the tabs dynamic and wire them up to the customer list box. To do this follow these steps:
- Update
MainWindow.xaml
as follows:</Expander.Header> <StackPanel> <ListBox ItemsSource="{Binding Customers}" DisplayMemberPath="CompanyName" SelectedValuePath="CustomerID" VerticalAlignment="Top" SelectedValue="{Binding SelectedCustomerID}" Height="180" Width="250" /> <ContentControl Margin="0, 3"> <Hyperlink Click="Hyperlink_Click"> <TextBlock Text="Show Details" /> </Hyperlink> </ContentControl> </StackPanel> </Expander>
- Add a
using
statement forNorthwind.ViewModel
inMainWindow.xaml.cs
. - Add the following function to
MainWindow
inMainWindow.xaml.cs
.private MainWindowViewModel ViewModel { get { return ...
Get MVVM Survival Guide for Enterprise Architectures in Silverlight and WPF now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.