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:

  1. 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>
    
  2. Add a using statement for Northwind.ViewModel in MainWindow.xaml.cs.
  3. Add the following function to MainWindow in MainWindow.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.