RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Learn Navigation in "Avalon"—the Windows Presentation Foundation : Page 3

Windows Presentation Foundation, the nascent framework for building next-generation user interfaces in Windows Vista, is available now in beta, but you don't have to wait for Vista to get started. In this second article in the series, we show you how to use the new navigation model.

Hierarchical Navigation
Figure 15. Hierarchy of Three: This hierarchical navigation application has pages 2 and 3 returning always to page 1.
In a WPF app with hierarchical navigation, users can branch out to other pages based on their choice. Figure 15 shows a typical hierarchical navigation application. Note that each page can branch out to as many pages as required, but as each page exits it will return to its calling page.

Figure 16 shows an example implementation of the hierarchical navigation application shown in Figure 15. In the first page, the user can enter his name and to select his country, he can click on the Select Country button to load the second page. To select his industry, he can click on the Select Industry button to load the third page. The pages for selecting country and industry both return to Page 1.

Once the selections are made, the results are shown on the main page, which serves as the master page for the entire application (see Figure 17).

Listing 1 is the code—broken into six sections—of the code for the three pages. Please be careful to heed the breaks in this code. Subheads are given.

Figure 16. Two Child Pages: An implementation of a hierarchical navigation application is shown.
Figure 17. Back to the Beginning: Data entered from the other pages are shown in Page1.xaml.

In this article, you have seen an overview, and two simple drill-downs, on how to paginate applications in the Windows Presentation Framework (Avalon). You have seen the five types of PageFunction pages available. In the next article, I will show you how data-binding is done in Avalon.

Wei-Meng Lee is a Microsoft MVP and founder of Developer Learning Solutions, a technology company specializing in hands-on training on the latest Microsoft technologies. He is an established developer and trainer specializing in .NET and wireless technologies. Wei-Meng speaks regularly at international conferences and has authored and coauthored numerous books on .NET, XML, and wireless technologies. He writes extensively on topics ranging from .NET to Mac OS X. He is also the author of the .NET Compact Framework Pocket Guide, ASP.NET 2.0: A Developer's Notebook (both from O'Reilly Media, Inc.), and Programming Sudoku (Apress). Here is Wei-Meng's blog.
Email AuthorEmail Author
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date