NavigationCommands.NavigateJournal Proprietà

Definizione

Ottiene il valore che rappresenta il comando 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

Valore della proprietà

Comando indirizzato dell'interfaccia utente.

Valori predefiniti
Combinazione di tasti N/D
Testo interfaccia utente Navigazione journal

Esempio

Nell'esempio seguente viene illustrato come usare NavigateJournal in combinazione con un oggetto Frame. fornisce Frame un'implementazione che risponde al NavigateJournal comando passando alla voce del journal specificata negli stack forward o back dell'oggetto Frame. Le voci del journal vengono fornite dall'oggetto JournalEntryUnifiedViewConverter al livello Navigate JournalMenuItemsuperiore. Ogni voce del journal è associata a un elemento figlio MenuItem che usa il NavigateJournal comando .

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

Commenti

Questo comando indica l'intenzione di spostarsi nel journal.

Frame e NavigationWindow implementano il supporto per rispondere al NavigateJournal comando, anche se non è necessario usarlo. In molti casi l'implementazione in risposta a tale comando è responsabilità del writer dell'applicazione.

Uso della sintassi XAML per gli attributi

<object property="NavigationCommands.NavigateJournal"/>  

Si applica a

Vedi anche