JournalEntryUnifiedViewConverter 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
JournalEntryUnifiedViewConverter將導航的回溯歷史與前進導航的歷史(由或 Frame所顯示NavigationWindow)合併為單一導覽選單。
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支援歷史瀏覽的 Display Navigation Chrome,透過以下機制:
一個按鈕,一次回溯一段內容。
一個按鈕,一次只瀏覽一個內容。
一個下拉選單顯示:
- 合併清單,包含最多九項後方導航歷史及最多九項前方導航歷史項目。
- 目前內容相較於前後導航歷史的位置。
導航歷史可由以下屬性儲存NavigationWindowFrame:
回溯導覽歷史: Frame.BackStack, NavigationWindow.BackStack.
前進航行歷史: Frame.ForwardStack, NavigationWindow.ForwardStack。
建立下拉選單, NavigationWindow 並 Frame 用 JournalEntryUnifiedViewConverter 來將各自的後退導航歷史與前向導航歷史合併成單一的導航歷史條目清單。 最終的清單包含最多九條來自後退導航歷史的條目,以及最多九條來自前向導航歷史的條目,外加一條目前內容的條目。
如果你建立自訂導航介面並需要提供下拉選單,也可以用 JournalEntryUnifiedViewConverter 來達到類似效果。
XAML 屬性使用方式
此類別通常不用於 XAML。
建構函式
| 名稱 | Description |
|---|---|
| JournalEntryUnifiedViewConverter() |
初始化 JournalEntryUnifiedViewConverter 類別的新執行個體。 |
欄位
| 名稱 | Description |
|---|---|
| JournalEntryPositionProperty |
JournalEntryPosition識別所附財產。 |
附加屬性
| 名稱 | Description |
|---|---|
| JournalEntryPosition |
取得或設定一個值,指定條目是屬於回溯導航歷史、前進導航歷史,還是導航器的當前內容。 |
方法
| 名稱 | Description |
|---|---|
| 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) |