Reputation: 7279
I'm learning WPF, and NavigationWindow in particular. I want to add stuff to the window, like a status bar, a favorite bar, etc. Unfortunately when I try adding anything, I get an error.
I'm hoping there might be a way that pages can be bookmarked as someone browses between them; let the user drag pages up to a favorite bar.
Something similar with the status bar; I'd like to have page specific information on the status bar, without having to have it on each individual page.
Is this possible with a navigation window, or am I barking up the wrong tree?
Edit:
<NavigationWindow x:Class="Window2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Nav Test" Height="300" Width="300" Source="Window1.xaml" >
<StatusBar></StatusBar> ' The type 'NavigationWindow' does not support direct content.
</NavigationWindow>
Update, What I went with:
<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Tracks" Height="350" Width="525">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="20" />
<RowDefinition Height="26" />
<RowDefinition Height="265*" />
</Grid.RowDefinitions>
<Menu Name="Menu1" />
<Frame Grid.Row="2" Name="Frame1" Source="PageSearchResults.xaml" />
<ToolBar Grid.Row="1" Name="ToolBar1" >
<Button Content="+" Name="Button1" />
</ToolBar>
</Grid>
</Window>
I ended up putting the status bar on the individual pages, so that I can more easily change what's displayed from page to page, but the tool bar behaves nicely with the frame.
Upvotes: 2
Views: 3367
Reputation: 97708
If you want your own content apart from the Page, then don't use NavigationWindow. Use a regular Window instead. Then, in the place where you want your navigation content, add a Frame. Frame supports all the same navigation you can do with a NavigationWindow (in fact, a NavigationWindow is basically just a Window with a Frame filling it).
Upvotes: 3
Reputation: 256
I'm new to WPF too but I believe a NavigationWindow needs a starting "Page" and that all your controls should be added to that page, not the NavigationWindow it's self. You could add a frame to the start page and do your navigations to other pages from that frame while the start page could contain your favorite bar, status bar etc.
Upvotes: 2