Step 7. Running the Window

Although the Window isn't finished yet, in this step you will get some positive feedback (and early gratification) by creating a menu bar that launches the Window and runs it for the first time.

  1. In the Solution Explorer, double-click MainWindow.xaml to open this Window in design mode.

  2. Go to the Properties window and set the Window's Title property to Customer Order System.

  3. Click the Window's menu to the right of the Lists menu pad:

    Go to the Properties Window and click the Items property ellipses button [...]. In the Collection Editor, select the [0] MenuItem in the ListBox on the left side of the dialog. Next, in the combo box below the list, select MenuItem and then click the Add button to add a new MenuItem:

    In the Properties list on the right of the dialog, change the Header property to Activities.

    Click OK to close the dialog and add the new menu pad.

  4. Select the new Activities menu pad:

    Go to the Properties Window and set the Name property of the new menu pad to ActivitiesPad.

  5. Now select the Items property ellipses button [...]. In the combo box at the bottom left of the Collection Editor, select MenuItem, and then click the Add button to add a new menu bar to the Activities menu pad. Set the Header property of the new menu bar to Customer Orders.

    Click OK to close the dialog and add the new menu bar.

  6. The easiest way to view the new menu bar is to go to the Document Outline window, expand the ActivitiesPad node and select the MenuItem "Customer Orders" node:

  7. Next, go to the Properties Window and set the Name property of the new menu bar to ActivitiesCustomerOrdersBar:

    This is a recommended naming convention; name your menu bars by listing the name of the pad first (Activities), the name of the bar second (CustomerOrders) and the word "Bar" as a suffix.

  8. Go to the Properties Window and select the Events button (the lightning bolt). This displays all the events associated with the menu item. Find the Click event and double-click in the box to the right of it.

    This creates a new ActivitiesCustomerOrdersBar_Click() event handler method. Add the following code to this method:

    Private Sub ActivitiesCustomerOrders_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles ActivitiesCustomerOrders.Click
        mmAppWPF.WindowManager.Show(New CustomerOrdersWindow(), Me)
    End Sub

    This code calls the Window Manager's Show() method passing a new instance of the Window and this -- a reference to the Main window.

  9. To run the application, click the Start button on the Visual Studio toolbar. When the main application form displays, you can select Activities | Customer Orders from the menu:

    When the Window displays, it should look like this:

    You can navigate around the Window and between the List and Properties pages, but you won't see any data until you perform the next few steps.

See Also:
Step 8. Registering Business Objects with the Window


© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 04/19/18
Comment or report problem with topic