JournalEntry JournalEntry JournalEntry JournalEntry Class

定义

表示后退或前进导航历史记录中的一个条目。Represents an entry in either back or forward navigation history.

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

示例

下面的示例演示如何检索后退导航堆栈中JournalEntry的最新对象, 以Name获取和Source属性值。The following example shows how to retrieve the most recent JournalEntry object from the back navigation stack to get the Name and Source property values.

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 ExplorerMicrosoft Internet Explorer的导航历史记录一样。Windows Presentation Foundation implements a navigation history service that stores one entry for each piece of content that has been previously navigated to, just like navigation history in Microsoft Internet ExplorerMicrosoft Internet Explorer. 导航历史记录包含两个堆栈, 一个用于记住后退导航历史记录, 另一个用于记住前进导航历史记录。Navigation history comprises two stacks, one that remembers back navigation history, and one that remembers forward navigation history.

当前进导航发生时, 当前项的项将添加到后退导航历史记录中。An entry for the current item is added to back navigation history when a forward navigation occurs. 在下列情况下会发生这种情况:This occurs in the following situations:

同样, 在发生后退导航之前, 会将当前项的项添加到前进导航历史记录中, 这会在以下情况发生:Likewise, an entry for the current item is added to forward navigation history before a back navigation occurs, which happens when:

后退和前进导航历史记录中的每个条目都是JournalEntry类的实例。Each entry in back and forward navigation history is an instance of the JournalEntry class.

JournalEntry个对象都封装了有关特定导航的信息, 包括条目的名称Name(), 是否将条目保持为统一资源标识符 (URI)uniform resource identifier (URI)活动KeepAlive状态 () 和导航到的内容 (Source)。Each JournalEntry object encapsulates information about a particular navigation, including a name for the entry (Name), whether the entry is kept alive (KeepAlive) and the 统一资源标识符 (URI)uniform resource identifier (URI) for the content that is navigated to (Source).

可以通过JournalEntry NavigationWindow.BackStack枚举或Frame.BackStack属性来检索后退导航历史记录中的所有对象。You can retrieve all the JournalEntry objects in back navigation history by enumerating the NavigationWindow.BackStack or Frame.BackStack properties. 对于前进导航历史记录, 可以通过JournalEntry NavigationWindow.ForwardStack枚举或Frame.ForwardStack属性检索所有对象。For forward navigation history, you can retrieve all the JournalEntry objects by enumerating the NavigationWindow.ForwardStack or Frame.ForwardStack properties.

例如, 如果需要从后退导航历史JournalEntry记录中删除最近使用的对象, 则可以RemoveBackEntry调用方法 (NavigationService.RemoveBackEntry, NavigationWindow.RemoveBackEntry, Frame.RemoveBackEntry), 这会删除JournalEntry对象并返回对它的引用。If you need to remove the most recent JournalEntry object from back navigation history, to prevent navigation to it, for example, you can call the RemoveBackEntry method (NavigationService.RemoveBackEntry, NavigationWindow.RemoveBackEntry, Frame.RemoveBackEntry), which removes the JournalEntry object and returns a reference to it.

但不能JournalEntry将对象添加到导航历史记录中, 因为您既不能实例JournalEntry化, 也不能从派生, 因为没有类型实现成员来执行此操作。You cannot add JournalEntry objects to navigation history, however, because you can neither instantiate nor derive from JournalEntry, and because no type implements a member to do so. 但是, 你CustomContentState可以通过AddBackEntry调用方法 (AddBackEntryAddBackEntryAddBackEntry) 将自定义对象添加到后退导航历史记录;将对象添加到内部创建JournalEntry的对象, 然后将该对象添加到后退导航历史记录中。 CustomContentState NavigationServiceHowever, you can add custom CustomContentState objects to back navigation history by calling the AddBackEntry method (AddBackEntry, AddBackEntry, AddBackEntry); NavigationService adds the CustomContentState object to an internally-created JournalEntry object, which is then added to the back navigation history.

构造函数

JournalEntry(SerializationInfo, StreamingContext) JournalEntry(SerializationInfo, StreamingContext) JournalEntry(SerializationInfo, StreamingContext) JournalEntry(SerializationInfo, StreamingContext)

初始化 JournalEntry 类的新实例。Initializes a new instance of the JournalEntry class.

字段

KeepAliveProperty KeepAliveProperty KeepAliveProperty KeepAliveProperty

标识 KeepAlive 附加属性。Identifies the KeepAlive attached property.

NameProperty NameProperty NameProperty NameProperty

标识 Name 附加属性。Identifies the Name attached property.

属性

CustomContentState CustomContentState CustomContentState CustomContentState

获取或设置与日记条目关联的 CustomContentState 对象。Gets or sets the CustomContentState object that is associated with this journal entry.

DependencyObjectType DependencyObjectType DependencyObjectType DependencyObjectType

获取对此实例的 CLRCLR 类型进行包装的 DependencyObjectTypeGets the DependencyObjectType that wraps the CLRCLR type of this instance.

(Inherited from DependencyObject)
Dispatcher Dispatcher Dispatcher Dispatcher

获取与此 Dispatcher 关联的 DispatcherObjectGets the Dispatcher this DispatcherObject is associated with.

(Inherited from DispatcherObject)
IsSealed IsSealed IsSealed IsSealed

获取一个值,该值指示此实例当前是否为密封的(只读)。Gets a value that indicates whether this instance is currently sealed (read-only).

(Inherited from DependencyObject)
Name Name Name Name

获取或设置日记条目的名称。Gets or sets the name of the journal entry.

Source Source Source Source

获取或设置导航到的内容的 URI。Gets or sets the URI of the content that was navigated to.

附加属性

KeepAlive KeepAlive KeepAlive KeepAlive

获取或设置一个值,该值指示在导航到日记条目内容时,在导航历史记录中是保留还是重新创建内容。Gets or sets a value that indicates whether the content of a journal entry is either retained or re-created when navigated to in navigation history.

方法

CheckAccess() CheckAccess() CheckAccess() CheckAccess()

确定调用线程是否可以访问此 DispatcherObjectDetermines whether the calling thread has access to this DispatcherObject.

(Inherited from DispatcherObject)
ClearValue(DependencyProperty) ClearValue(DependencyProperty) ClearValue(DependencyProperty) ClearValue(DependencyProperty)

清除属性的本地值。Clears the local value of a property. 要清除的属性由 DependencyProperty 标识符指定。The property to be cleared is specified by a DependencyProperty identifier.

(Inherited from DependencyObject)
ClearValue(DependencyPropertyKey) ClearValue(DependencyPropertyKey) ClearValue(DependencyPropertyKey) ClearValue(DependencyPropertyKey)

清除只读属性的本地值。Clears the local value of a read-only property. 要清除的属性由 DependencyPropertyKey 指定。The property to be cleared is specified by a DependencyPropertyKey.

(Inherited from DependencyObject)
CoerceValue(DependencyProperty) CoerceValue(DependencyProperty) CoerceValue(DependencyProperty) CoerceValue(DependencyProperty)

对指定依赖属性的值进行强制。Coerces the value of the specified dependency property. 通过对调用方 DependencyObject 上存在的依赖属性的属性元数据中所指定的任何 CoerceValueCallback 函数进行调用来完成此操作。This is accomplished by invoking any CoerceValueCallback function specified in property metadata for the dependency property as it exists on the calling DependencyObject.

(Inherited from DependencyObject)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定提供的 DependencyObject 是否等效于当前 DependencyObjectDetermines whether a provided DependencyObject is equivalent to the current DependencyObject.

(Inherited from DependencyObject)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

获取此 DependencyObject 的哈希代码。Gets a hash code for this DependencyObject.

(Inherited from DependencyObject)
GetKeepAlive(DependencyObject) GetKeepAlive(DependencyObject) GetKeepAlive(DependencyObject) GetKeepAlive(DependencyObject)

返回指定元素的日记条目的附加属性 KeepAliveReturns the KeepAlive attached property of the journal entry for the specified element.

GetLocalValueEnumerator() GetLocalValueEnumerator() GetLocalValueEnumerator() GetLocalValueEnumerator()

创建一个专用的枚举数,用于确定哪些依赖项属性在此 DependencyObject 上具有以本地方式设置的值。Creates a specialized enumerator for determining which dependency properties have locally set values on this DependencyObject.

(Inherited from DependencyObject)
GetName(DependencyObject) GetName(DependencyObject) GetName(DependencyObject) GetName(DependencyObject)

设置指定元素日记条目的 Name 附加属性。Gets the Name attached property of the journal entry for the specified element.

GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext)

将此对象序列化时调用。Called when this object is serialized.

GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
GetValue(DependencyProperty) GetValue(DependencyProperty) GetValue(DependencyProperty) GetValue(DependencyProperty)

DependencyObject 的此实例返回依赖属性的当前有效值。Returns the current effective value of a dependency property on this instance of a DependencyObject.

(Inherited from DependencyObject)
InvalidateProperty(DependencyProperty) InvalidateProperty(DependencyProperty) InvalidateProperty(DependencyProperty) InvalidateProperty(DependencyProperty)

重新计算指定依赖项属性的有效值Re-evaluates the effective value for the specified dependency property

(Inherited from DependencyObject)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
OnPropertyChanged(DependencyPropertyChangedEventArgs) OnPropertyChanged(DependencyPropertyChangedEventArgs) OnPropertyChanged(DependencyPropertyChangedEventArgs) OnPropertyChanged(DependencyPropertyChangedEventArgs)

每当更新此 DependencyObject 的任何依赖属性的有效值时调用。Invoked whenever the effective value of any dependency property on this DependencyObject has been updated. 更改的特定依赖项属性将在事件数据中报告。The specific dependency property that changed is reported in the event data.

(Inherited from DependencyObject)
ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty)

如果存在,则返回依赖属性的本地值。Returns the local value of a dependency property, if it exists.

(Inherited from DependencyObject)
SetCurrentValue(DependencyProperty, Object) SetCurrentValue(DependencyProperty, Object) SetCurrentValue(DependencyProperty, Object) SetCurrentValue(DependencyProperty, Object)

设置依赖属性的值而不更改其值源。Sets the value of a dependency property without changing its value source.

(Inherited from DependencyObject)
SetKeepAlive(DependencyObject, Boolean) SetKeepAlive(DependencyObject, Boolean) SetKeepAlive(DependencyObject, Boolean) SetKeepAlive(DependencyObject, Boolean)

设置指定元素的 KeepAlive 附加属性。Sets the KeepAlive attached property of the specified element.

SetName(DependencyObject, String) SetName(DependencyObject, String) SetName(DependencyObject, String) SetName(DependencyObject, String)

设置指定元素的 Name 附加属性。Sets the Name attached property of the specified element.

SetValue(DependencyProperty, Object) SetValue(DependencyProperty, Object) SetValue(DependencyProperty, Object) SetValue(DependencyProperty, Object)

设置依赖属性的本地值,该值由其依赖属性标识符指定。Sets the local value of a dependency property, specified by its dependency property identifier.

(Inherited from DependencyObject)
SetValue(DependencyPropertyKey, Object) SetValue(DependencyPropertyKey, Object) SetValue(DependencyPropertyKey, Object) SetValue(DependencyPropertyKey, Object)

设置一个只读依赖属性的本地值,该值由依赖属性的 DependencyPropertyKey 标识符指定。Sets the local value of a read-only dependency property, specified by the DependencyPropertyKey identifier of the dependency property.

(Inherited from DependencyObject)
ShouldSerializeProperty(DependencyProperty) ShouldSerializeProperty(DependencyProperty) ShouldSerializeProperty(DependencyProperty) ShouldSerializeProperty(DependencyProperty)

返回一个值,该值指示序列化进程是否应序列化所提供的依赖属性的值。Returns a value that indicates whether serialization processes should serialize the value for the provided dependency property.

(Inherited from DependencyObject)
ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)
VerifyAccess() VerifyAccess() VerifyAccess() VerifyAccess()

强制调用线程具有此 DispatcherObject 的访问权限。Enforces that the calling thread has access to this DispatcherObject.

(Inherited from DispatcherObject)

适用于