O'Reilly logo

MVVM Survival Guide for Enterprise Architectures in Silverlight and WPF by Muhammad Shujaat Siddiqi, Ryan Vice

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required