Breyta

Deila með


JournalEntry Class

Definition

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
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
Inheritance
Attributes
Implements

Examples

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

Remarks

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 a browser. 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:

Each entry in back and forward navigation history is an instance of the JournalEntry class.

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 uniform resource identifier (URI) for the content that is navigated to (Source).

You can retrieve all the JournalEntry objects in back navigation history by enumerating the NavigationWindow.BackStack or Frame.BackStack properties. For forward navigation history, you can retrieve all the JournalEntry objects by enumerating the NavigationWindow.ForwardStack or Frame.ForwardStack properties.

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.

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. However, 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.

Constructors

JournalEntry(SerializationInfo, StreamingContext)

Initializes a new instance of the JournalEntry class.

Fields

KeepAliveProperty

Identifies the KeepAlive attached property.

NameProperty

Identifies the Name attached property.

Properties

CustomContentState

Gets or sets the CustomContentState object that is associated with this journal entry.

DependencyObjectType

Gets the DependencyObjectType that wraps the CLR type of this instance.

(Inherited from DependencyObject)
Dispatcher

Gets the Dispatcher this DispatcherObject is associated with.

(Inherited from DispatcherObject)
IsSealed

Gets a value that indicates whether this instance is currently sealed (read-only).

(Inherited from DependencyObject)
Name

Gets or sets the name of the journal entry.

Source

Gets or sets the URI of the content that was navigated to.

Attached Properties

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.

Methods

CheckAccess()

Determines whether the calling thread has access to this DispatcherObject.

(Inherited from DispatcherObject)
ClearValue(DependencyProperty)

Clears the local value of a property. The property to be cleared is specified by a DependencyProperty identifier.

(Inherited from DependencyObject)
ClearValue(DependencyPropertyKey)

Clears the local value of a read-only property. The property to be cleared is specified by a DependencyPropertyKey.

(Inherited from DependencyObject)
CoerceValue(DependencyProperty)

Coerces the value of the specified dependency property. 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)

Determines whether a provided DependencyObject is equivalent to the current DependencyObject.

(Inherited from DependencyObject)
GetHashCode()

Gets a hash code for this DependencyObject.

(Inherited from DependencyObject)
GetKeepAlive(DependencyObject)

Returns the KeepAlive attached property of the journal entry for the specified element.

GetLocalValueEnumerator()

Creates a specialized enumerator for determining which dependency properties have locally set values on this DependencyObject.

(Inherited from DependencyObject)
GetName(DependencyObject)

Gets the Name attached property of the journal entry for the specified element.

GetObjectData(SerializationInfo, StreamingContext)

Called when this object is serialized.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
GetValue(DependencyProperty)

Returns the current effective value of a dependency property on this instance of a DependencyObject.

(Inherited from DependencyObject)
InvalidateProperty(DependencyProperty)

Re-evaluates the effective value for the specified dependency property.

(Inherited from DependencyObject)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
OnPropertyChanged(DependencyPropertyChangedEventArgs)

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)

Returns the local value of a dependency property, if it exists.

(Inherited from DependencyObject)
SetCurrentValue(DependencyProperty, Object)

Sets the value of a dependency property without changing its value source.

(Inherited from DependencyObject)
SetKeepAlive(DependencyObject, Boolean)

Sets the KeepAlive attached property of the specified element.

SetName(DependencyObject, String)

Sets the Name attached property of the specified element.

SetValue(DependencyProperty, Object)

Sets the local value of a dependency property, specified by its dependency property identifier.

(Inherited from DependencyObject)
SetValue(DependencyPropertyKey, Object)

Sets the local value of a read-only dependency property, specified by the DependencyPropertyKey identifier of the dependency property.

(Inherited from DependencyObject)
ShouldSerializeProperty(DependencyProperty)

Returns a value that indicates whether serialization processes should serialize the value for the provided dependency property.

(Inherited from DependencyObject)
ToString()

Returns a string that represents the current object.

(Inherited from Object)
VerifyAccess()

Enforces that the calling thread has access to this DispatcherObject.

(Inherited from DispatcherObject)

Applies to