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)、專案是否保持運作 (KeepAlive), 以及統一資源識別項 (URI)uniform resource identifier (URI)流覽至的內容 (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.RemoveBackEntryNavigationWindow.RemoveBackEntryFrame.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. 叫用存在於呼叫 CoerceValueCallback 上相依性屬性之屬性中繼資料內所指定的任何 DependencyObject 函式,就可以達到這一點。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 和目前的 DependencyObject 是否相等。Determines 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)

傳回所指定項目 (element) 之日誌項目 (entry) 的 KeepAlive 附加屬性。Returns 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)

取得所指定項目 (element) 之日誌項目 (entry) 的 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 的淺層複本 (Shallow Copy)。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)

適用於