JournalEntryUnifiedViewConverter 类

定义

JournalEntryUnifiedViewConverter 将后退导航历史记录和前进导航历史记录(由 FrameNavigationWindow 公开)合并为单一的 Windows Internet Explorer 7 种样式的导航菜单。

public ref class JournalEntryUnifiedViewConverter sealed : System::Windows::Data::IMultiValueConverter
public sealed class JournalEntryUnifiedViewConverter : System.Windows.Data.IMultiValueConverter
type JournalEntryUnifiedViewConverter = class
    interface IMultiValueConverter
Public NotInheritable Class JournalEntryUnifiedViewConverter
Implements IMultiValueConverter
继承
JournalEntryUnifiedViewConverter
实现

示例

以下示例演示如何构造基于文本的导航历史记录菜单。 菜单使用 JournalEntryUnifiedViewConverter 合并托管 Frame 导航器的后向导航和前进导航历史记录。

<Window 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:presentationFramework="clr-namespace:System.Windows.Navigation;assembly=presentationframework"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="JournalEntryUnifiedPositionConverterSnippets"
    >

    <Window.Resources>

        <presentationFramework:JournalEntryUnifiedViewConverter x:Key="JournalEntryUnifiedViewConverter" />

        <!--MenuItem data template-->
        <DataTemplate x:Key="JournalEntryMenuItemTemplate">
            <MenuItem VerticalContentAlignment="Center" Command="NavigationCommands.NavigateJournal" CommandTarget="{Binding ElementName=frame}" CommandParameter="{Binding RelativeSource={RelativeSource Self}}">
                <MenuItem.Template>
                    <ControlTemplate>
                        <TextBlock>
                            <TextBlock Text="{Binding (JournalEntryUnifiedViewConverter.JournalEntryPosition)}" FontWeight="Bold"></TextBlock>
                            <LineBreak />
                            <TextBlock Text="{Binding Path=Name}" />
                        </TextBlock>
                    </ControlTemplate>
                </MenuItem.Template>
            </MenuItem>
        </DataTemplate>

    </Window.Resources>

    <DockPanel>

        <!--Unified navigation history menu-->
        <Menu DockPanel.Dock="Top">
            <MenuItem Header="Unified Navigation History" ItemTemplate="{DynamicResource JournalEntryMenuItemTemplate}">
                <MenuItem.ItemsSource>
                    <MultiBinding Converter="{StaticResource JournalEntryUnifiedViewConverter}">
                        <MultiBinding.Bindings>
                            <Binding ElementName="frame" Path="BackStack"/>
                            <Binding ElementName="frame" Path="ForwardStack" />
                        </MultiBinding.Bindings>
                    </MultiBinding>
                </MenuItem.ItemsSource>
            </MenuItem>
        </Menu>

        <!--Navigator (Frame with its navigation chrome hidden-->
        <Frame Name="frame" NavigationUIVisibility="Hidden" Source="HomePage.xaml" />

    </DockPanel>
    
</Window>

注解

FrameNavigationWindow 显示使用以下机制支持历史记录导航的导航部件版式:

  • 用于一次向后导航一条内容的按钮。

  • 用于一次向前导航一条内容的按钮。

  • Windows Internet Explorer 7 样式下拉列表,其中显示:

    • 后退导航历史记录中最多包含 9 个项目和前进导航历史记录中最多 9 项的组合列表。

    • 当前内容段相对于后向导航历史记录和前进导航历史记录的位置。

导航历史记录由 NavigationWindowFrame 存储在以下属性中:

后退导航历史记录Frame.BackStackNavigationWindow.BackStack

前进导航历史记录Frame.ForwardStackNavigationWindow.ForwardStack

创建 Windows Internet Explorer 7 样式下拉列表, NavigationWindow 并使用 FrameJournalEntryUnifiedViewConverter 将各自的后退导航历史记录和前进导航历史记录合并到导航历史记录的单个列表中。 生成的列表最多包含来自后退导航历史记录的 9 个条目和来自前进导航历史记录的最多 9 个条目,以及当前内容的条目。

如果你创建自定义导航 UI,并且需要提供 Windows Internet Explorer 7 样式的下拉列表,则可以使用 JournalEntryUnifiedViewConverter 类似的效果。

XAML 属性用法

此类通常不在 XAML 中使用。

构造函数

JournalEntryUnifiedViewConverter()

初始化 JournalEntryUnifiedViewConverter 类的新实例。

字段

JournalEntryPositionProperty

标识 JournalEntryPosition 附加属性。

附加属性

JournalEntryPosition

获取或设置一个值,该值指定项是后退导航历史记录、前进导航历史记录还是导航器的当前内容。

方法

Convert(Object[], Type, Object, CultureInfo)

合并两个导航历史记录堆栈。

ConvertBack(Object, Type[], Object, CultureInfo)

未实现。

Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetJournalEntryPosition(DependencyObject)

获取指定的元素的 JournalEntryPosition 附加属性。

GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
SetJournalEntryPosition(DependencyObject, JournalEntryPosition)

设置指定元素的 JournalEntryPositionProperty 附加属性。

ToString()

返回表示当前对象的字符串。

(继承自 Object)

适用于

另请参阅