Listing Customers

The Bank root object's collection of Customer objects is to be displayed in the lstCustomers list box. For simplicity, only the surname of the customer is displayed.

  1. In the MainWindow.xaml form, double‑click the Refresh button. This adds a click event method in the MainWindow.xaml.cs code file.

  2. Add the following code to the btnRefresh_Click method.

    private void btnRefresh_Click(object sender, RoutedEventArgs e)
    {
       lstCustomers.ItemsSource = bank.AllCustomers;
       lstCustomers.DisplayMemberPath = "LastName";
    }
    
  3. Run the BankingApp application and then click the Refresh button.

    If you have created Customer objects previously as part of the JADE developer's course, they are displayed.