Thus far, we've spent a lot of time talking about the NavigationWindow, how it handles navigation, and how it integrates with pages and page functions. However, the navigation window is but one navigation host. A navigation host in WPF is anything that provides navigation support. Besides the navigation window, which provides top-level window navigation support, WPF also provides the Frame, for contained navigation support. For example, nothing is stopping us from hosting our guessing game in a frame, which is itself contained by something else, as shown in Example 11-19.
* You were perhaps expecting "abracadabra"?
Figure 11-9. A page function in action
Example 11-19. Using a frame navigation host
<Border BorderBrush="Green" BorderThickness="10"> <Frame Source="Page1.xaml" />
In Example 11-19, we're hosting a Frame in a window, but you can host it equally well in a page. The main property you'll care about on the Frame class is the Source, which indicates where you'd like to start navigation. Figure 11-10 shows the results of making one guess on the history for the frame.
Frames are useful when you'd like to add navigation to part of your window (or to multiple parts), but you don't want the entire window dedicated to it. For example, your average web site is composed of a set of content that goes inside a navigation frame, including menus, graphics, and so on. The Frame element is one way to implement the content inside the outer navigation frame.
[i~i Would You Like To Play A Game?
v Current Page v Current Page
Figure 11-10. Using a frame navigation host
Was this article helpful?
What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.