共用方式為


NavigationCommands.NavigateJournal 屬性

定義

取得值,表示 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

屬性值

路由UI命令。

預設值
按鍵手勢 N/A
UI 文字 瀏覽紀錄

範例

下列範例示範如何使用 NavigateJournal 搭配 FrameFrame 提供實作,透過巡覽至 Frame的正向或後置堆棧上的指定日誌專案,以回應 NavigateJournal 命令。 日誌專案是由 JournalEntryUnifiedViewConverter 提供給最上層 Navigate JournalMenuItem。 每個日誌項目都會系結至使用 NavigateJournal 命令的子 MenuItem

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

備註

此命令指出巡覽日誌的意圖。

FrameNavigationWindow 實作回應 NavigateJournal 命令的支持,不過您不需要使用它;在許多情況下,實作會響應該命令是應用程式寫入器的責任。

XAML 屬性使用方式

<object property="NavigationCommands.NavigateJournal"/>  

適用於

另請參閱