具有更多控件的 WPF 导航窗口

标签 wpf vb.net visual-studio-2010 wpf-controls

我正在学习 WPF,特别是 NavigationWindow。我想向窗口添加内容,例如状态栏、收藏夹栏等。 不幸的是,当我尝试添加任何内容时,出现错误。

我希望有一种方法可以在有人浏览页面时为页面添加书签;让用户将页面拖动到最喜欢的栏。

与状态栏类似的东西;我希望在状态栏上显示页面特定信息,而不必在每个单独的页面上显示它。

这可以通过导航窗口实现吗?还是我找错了树?

编辑:

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

更新,我选择了什么:

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

我最终将状态栏放在各个页面上,以便我可以更轻松地更改页面之间显示的内容,但工具栏与框架表现得很好。

最佳答案

如果您想要除页面之外的自己的内容,则不要使用 NavigationWindow。请改用常规窗口。然后,在您想要导航内容的位置添加 Frame 。 Frame 支持使用 NavigationWindow 可以执行的所有相同导航(事实上,NavigationWindow 基本上只是一个填充了 Frame 的窗口)。

关于具有更多控件的 WPF 导航窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5795140/

相关文章:

.net - MSI 安装程序文件名中的 Exe 版本 (VS 2010)

c++ - app.config Visual Studio 创建

wpf - 如何将 TextBox 的 TextWrapping 属性绑定(bind)到 MenuItem 的 IsChecked 值?

c# - 如何在 WPF 中重新加载(重置)整个页面?

javascript - 在后面的代码中返回 "full"clientID (asp.net VB)

vb.net - 列表:检测从小于零到大于零的开关

vb.net - 为什么我的标签不显示在 VB.NET 表单中

c# - 取消长时间运行的 Entity Framework 6 异步请求

wpf - 在工具提示中添加断线

c# - 在 VS2010 c# 中调试 EXCHANGE 传输代理