JournalEntry 类

定义

表示后退或前进导航历史记录中的一个条目。

public ref class JournalEntry : System::Windows::DependencyObject, System::Runtime::Serialization::ISerializable
[System.Serializable]
public class JournalEntry : System.Windows.DependencyObject, System.Runtime.Serialization.ISerializable
public class JournalEntry : System.Windows.DependencyObject, System.Runtime.Serialization.ISerializable
[<System.Serializable>]
type JournalEntry = class
    inherit DependencyObject
    interface ISerializable
type JournalEntry = class
    inherit DependencyObject
    interface ISerializable
Public Class JournalEntry
Inherits DependencyObject
Implements ISerializable
继承
属性
实现

示例

以下示例演示如何从后退导航堆栈检索最新的 JournalEntry 对象以获取 NameSource 属性值。

void removeJournalEntryButton_Click(object sender, RoutedEventArgs e)
{
    // If there are journal entries on the back navigation stack
    if (this.NavigationService.CanGoBack)
    {
        // Remove and get the most recent entry on the back navigation stack
        JournalEntry journalEntry = this.NavigationService.RemoveBackEntry();

        string name = journalEntry.Name;
        string uri = journalEntry.Source.OriginalString;
        MessageBox.Show(name + " [" + uri + "] removed from back navigation.");
    }
}
Private Sub removeJournalEntryButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
    ' If there are journal entries on the back navigation stack
    If Me.NavigationService.CanGoBack Then
        ' Remove and get the most recent entry on the back navigation stack
        Dim journalEntry As JournalEntry = Me.NavigationService.RemoveBackEntry()

        Dim name As String = journalEntry.Name
        Dim uri As String = journalEntry.Source.OriginalString
        MessageBox.Show(name & " [" & uri & "] removed from back navigation.")
    End If
End Sub

注解

Windows Presentation Foundation实现导航历史记录服务,该服务存储以前导航到的每个内容一个条目,就像 Microsoft Internet Explorer 中的导航历史记录一样。 导航历史记录包括两个堆栈,一个堆栈用于记住后退导航历史记录,一个堆栈用于记住前向导航历史记录。

发生向前导航时,当前项的条目将添加到后退导航历史记录。 这种情况发生在以下情况下:

同样,在发生后退导航之前,会将当前项的条目添加到前向导航历史记录,当以下情况发生时发生:

后退导航历史记录和向前导航历史记录中的每个条目都是类的 JournalEntry 实例。

每个 JournalEntry 对象封装有关特定导航的信息,包括条目 () Name 的名称、条目是否保持活动状态 () KeepAlive 以及导航到 () Source 内容的统一资源标识符 (URI) 。

可以通过枚举NavigationWindow.BackStackFrame.BackStack属性来检索后退导航历史记录中的所有JournalEntry对象。 对于前向导航历史记录,可以通过枚举NavigationWindow.ForwardStackFrame.ForwardStack属性来检索所有JournalEntry对象。

如果需要从后退导航历史记录中删除最近的 JournalEntry 对象,以防止导航到它,例如,可以调用 RemoveBackEntry 方法 (NavigationService.RemoveBackEntryNavigationWindow.RemoveBackEntry) Frame.RemoveBackEntry ,该方法将删除 JournalEntry 该对象并返回对其的引用。

但是,不能将对象添加到 JournalEntry 导航历史记录,因为既不能实例化也不能派生对象 JournalEntry,也不能从中派生对象,而且没有类型实现成员执行此操作。 但是,可以通过调用AddBackEntry方法 (AddBackEntry AddBackEntryAddBackEntry,) ;CustomContentStateNavigationService将自定义CustomContentState对象添加到内部创建JournalEntry的对象,然后将该对象添加到后退导航历史记录。

构造函数

JournalEntry(SerializationInfo, StreamingContext)

初始化 JournalEntry 类的新实例。

字段

KeepAliveProperty

标识 KeepAlive 附加属性。

NameProperty

标识 Name 附加属性。

属性

CustomContentState

获取或设置与日记条目关联的 CustomContentState 对象。

DependencyObjectType

获取包装 DependencyObjectType 此实例的 CLR 类型。

(继承自 DependencyObject)
Dispatcher

获取与此 Dispatcher 关联的 DispatcherObject

(继承自 DispatcherObject)
IsSealed

获取一个值,该值指示此实例当前是否为密封的(只读)。

(继承自 DependencyObject)
Name

获取或设置日记条目的名称。

Source

获取或设置导航到的内容的 URI。

附加属性

KeepAlive

获取或设置一个值,该值指示在导航到日记条目内容时,在导航历史记录中是保留还是重新创建内容。

方法

CheckAccess()

确定调用线程是否可以访问此 DispatcherObject

(继承自 DispatcherObject)
ClearValue(DependencyProperty)

清除属性的本地值。 要清除的属性由 DependencyProperty 标识符指定。

(继承自 DependencyObject)
ClearValue(DependencyPropertyKey)

清除只读属性的本地值。 要清除的属性由 DependencyPropertyKey 指定。

(继承自 DependencyObject)
CoerceValue(DependencyProperty)

对指定依赖属性的值进行强制。 通过对调用方 DependencyObject 上存在的依赖属性的属性元数据中所指定的任何 CoerceValueCallback 函数进行调用来完成此操作。

(继承自 DependencyObject)
Equals(Object)

确定提供的 DependencyObject 是否等效于当前 DependencyObject

(继承自 DependencyObject)
GetHashCode()

获取此 DependencyObject 的哈希代码。

(继承自 DependencyObject)
GetKeepAlive(DependencyObject)

返回指定元素的日记条目的附加属性 KeepAlive

GetLocalValueEnumerator()

创建一个专用的枚举数,用于确定哪些依赖项属性在此 DependencyObject 上具有以本地方式设置的值。

(继承自 DependencyObject)
GetName(DependencyObject)

设置指定元素日记条目的 Name 附加属性。

GetObjectData(SerializationInfo, StreamingContext)

将此对象序列化时调用。

GetType()

获取当前实例的 Type

(继承自 Object)
GetValue(DependencyProperty)

DependencyObject 的此实例返回依赖属性的当前有效值。

(继承自 DependencyObject)
InvalidateProperty(DependencyProperty)

重新评估指定依赖属性的有效值。

(继承自 DependencyObject)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
OnPropertyChanged(DependencyPropertyChangedEventArgs)

每当更新此 DependencyObject 的任何依赖属性的有效值时调用。 更改的特定依赖属性将在事件数据中报告。

(继承自 DependencyObject)
ReadLocalValue(DependencyProperty)

如果存在,则返回依赖属性的本地值。

(继承自 DependencyObject)
SetCurrentValue(DependencyProperty, Object)

设置依赖属性的值而不更改其值源。

(继承自 DependencyObject)
SetKeepAlive(DependencyObject, Boolean)

设置指定元素的 KeepAlive 附加属性。

SetName(DependencyObject, String)

设置指定元素的 Name 附加属性。

SetValue(DependencyProperty, Object)

设置依赖属性的本地值,该值由其依赖属性标识符指定。

(继承自 DependencyObject)
SetValue(DependencyPropertyKey, Object)

设置一个只读依赖属性的本地值,该值由依赖属性的 DependencyPropertyKey 标识符指定。

(继承自 DependencyObject)
ShouldSerializeProperty(DependencyProperty)

返回一个值,该值指示序列化进程是否应序列化所提供的依赖属性的值。

(继承自 DependencyObject)
ToString()

返回表示当前对象的字符串。

(继承自 Object)
VerifyAccess()

强制调用线程具有此 DispatcherObject 的访问权限。

(继承自 DispatcherObject)

适用于