NavigationCommands.NavigateJournal Propriété

Définition

Obtient la valeur qui représente la commande Navigate Journal.

public:
 static property System::Windows::Input::RoutedUICommand ^ NavigateJournal { System::Windows::Input::RoutedUICommand ^ get(); };
public static System.Windows.Input.RoutedUICommand NavigateJournal { get; }
static member NavigateJournal : System.Windows.Input.RoutedUICommand
Public Shared ReadOnly Property NavigateJournal As RoutedUICommand

Valeur de propriété

Commande d’interface utilisateur routée.

Valeurs par défaut
Combinaison de touches N/A
Texte d'interface utilisateur Journal de navigation

Exemples

L’exemple suivant montre comment utiliser NavigateJournal conjointement avec un Frame. fournit Frame une implémentation qui répond à la NavigateJournal commande en accédant à l’entrée de journal spécifiée sur les piles avant ou arrière du Frame. Les entrées de journal sont fournies par au JournalEntryUnifiedViewConverter niveau Navigate JournalMenuItemsupérieur . Chaque entrée de journal est liée à un enfant MenuItem qui utilise la NavigateJournal commande .

<Window
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

  <Window.Resources>
    <!-- For NavigationCommands.NavigateJournal -->
    <JournalEntryUnifiedViewConverter x:Key="JournalEntryUnifiedViewConverter" />
      <!--Create a DataTemplate to display the navigation history-->
    <DataTemplate x:Key="journalMenuItemTemplate">
      <TextBlock>
        <TextBlock Text="{Binding (JournalEntryUnifiedViewConverter.JournalEntryPosition)}" />
        <TextBlock FontWeight="Bold" FontStyle="Italic">
          <TextBlock Margin="5,0,0,0">(</TextBlock>
          <TextBlock Text="{Binding JournalEntry.Name}"/>
          <TextBlock Margin="5,0,0,0">)</TextBlock>
        </TextBlock>
      </TextBlock>
    </DataTemplate>
      <!--Create a style so that all the MenuItems will use the NavigateJournal command-->
    <Style x:Key="journalMenuItemContainerStyle">
      <Setter Property="MenuItem.Command" Value="NavigationCommands.NavigateJournal" />
      <Setter Property="MenuItem.CommandTarget" Value="{Binding ElementName=frame}" />
      <Setter Property="MenuItem.CommandParameter" Value="{Binding RelativeSource={RelativeSource Self}}" />
    </Style>
  </Window.Resources>
<!-- Create the Navigation menu using the template and style defined in Window.Resources-->
<MenuItem
  Header="Navigate Journal"
  ItemTemplate="{StaticResource journalMenuItemTemplate}"
  ItemContainerStyle="{StaticResource journalMenuItemContainerStyle}" >
    <!--Set the ItemsSource to be the IEnumerable returned from the JournalEntryUnifiedViewConverter-->
  <MenuItem.ItemsSource>
    <MultiBinding Converter="{StaticResource JournalEntryUnifiedViewConverter}" >
      <Binding ElementName="frame" Path="BackStack"/>
      <Binding ElementName="frame" Path="ForwardStack"/>
    </MultiBinding>
  </MenuItem.ItemsSource>
</MenuItem>
<!-- The following Frame is used to process NavigationCommands.NavigateJournal commands -->
<Frame Name="frame" NavigationUIVisibility="Hidden" Source="Page1.xaml" />
</Window>

Remarques

Cette commande indique l’intention de naviguer dans le journal.

Frame et NavigationWindow implémentez la prise en charge de la réponse à la NavigateJournal commande, bien que vous ne soyez pas obligé de l’utiliser ; dans de nombreux cas, l’implémentation en réponse à cette commande est la responsabilité de l’enregistreur d’application.

Utilisation d'attributs XAML

<object property="NavigationCommands.NavigateJournal"/>  

S’applique à

Voir aussi