Szerkesztés

Megosztás a következőn keresztül:


JournalEntryUnifiedViewConverter Class

Definition

JournalEntryUnifiedViewConverter merges navigation back history and navigation forward history (as exposed by Frame or NavigationWindow) into a single navigation menu.

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
Inheritance
JournalEntryUnifiedViewConverter
Implements

Examples

The following example shows how to construct a text-based navigation history menu. The menu uses JournalEntryUnifiedViewConverter to combine both the back and forward navigation histories of the hosted Frame navigator.

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

Remarks

Both Frame and NavigationWindow display navigation chrome that supports history navigation using the following mechanisms:

  • A button for navigating back one piece of content at a time.

  • A button for navigating forward one piece of content at a time.

  • A drop-down list that shows:

    • A combined list of up to nine items in back navigation history and up to nine items in forward navigation history.
    • The position of the current piece of content with respect to both back and forward navigation history.

The navigation history is stored by both NavigationWindow and Frame in the following properties:

Back Navigation History: Frame.BackStack, NavigationWindow.BackStack.

Forward Navigation History: Frame.ForwardStack, NavigationWindow.ForwardStack.

To create the drop-down list, NavigationWindow and Frame use JournalEntryUnifiedViewConverter to merge their individual back navigation history and forward navigation history into a single list of navigation history entries. The resulting list contains up to nine entries from back navigation history and up to nine entries from forward navigation history, plus an entry for the current content.

If you create custom navigation UI and need to provide a drop-down list, you can use JournalEntryUnifiedViewConverter to similar effect.

XAML Attribute Usage

This class is not typically used in XAML.

Constructors

JournalEntryUnifiedViewConverter()

Initializes a new instance of the JournalEntryUnifiedViewConverter class.

Fields

JournalEntryPositionProperty

Identifies the JournalEntryPosition attached property.

Attached Properties

JournalEntryPosition

Gets or sets a value that specifies whether an entry is in back navigation history, forward navigation history, or is the current content of a navigator.

Methods

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

Merges two navigation history stacks.

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

Not implemented.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetJournalEntryPosition(DependencyObject)

Gets the JournalEntryPosition attached property for the specified element.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
SetJournalEntryPosition(DependencyObject, JournalEntryPosition)

Sets the JournalEntryPositionProperty attached property of the specified element.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also