Skip to Main Content
Programming WPF, 2nd Edition
book

Programming WPF, 2nd Edition

by Chris Sells, Ian Griffiths
August 2007
Intermediate to advanced content levelIntermediate to advanced
864 pages
25h 52m
English
O'Reilly Media, Inc.
Content preview from Programming WPF, 2nd Edition

Frames

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.

Example 11-19. Using a frame navigation host

<!-- Window1.xaml -->
<Window ...>
  <Border BorderBrush="Green" BorderThickness="10">
  <Frame Source="Page1.xaml" />
  </Border>
</Window>

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.

Using a frame navigation host

Figure 11-10. Using a frame navigation host

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

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming C#, 4th Edition

Programming C#, 4th Edition

Jesse Liberty
Programming C# 10

Programming C# 10

Ian Griffiths

Publisher Resources

ISBN: 9780596510374Supplemental ContentErrata Page