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