CustomContentState 클래스

정의

CustomContentState는 이후의 각 탐색에 대해 소스 콘텐츠를 다시 로드하지 않고 단일 소스 콘텐츠의 여러 상태를 탐색하는 기능을 활성화합니다.

public ref class CustomContentState abstract
[System.Serializable]
public abstract class CustomContentState
public abstract class CustomContentState
[<System.Serializable>]
type CustomContentState = class
type CustomContentState = class
Public MustInherit Class CustomContentState
상속
CustomContentState
특성

예제

다음은 재정의하는 CustomContentState 구현의 예입니다 JournalEntryName.

using System;
using System.Windows.Controls;
using System.Windows.Navigation;
[Serializable]
public class MyCustomContentState : CustomContentState
{
    string dateCreated;
    TextBlock dateTextBlock;

    public MyCustomContentState(string dateCreated, TextBlock dateTextBlock)
    {
        this.dateCreated = dateCreated;
        this.dateTextBlock = dateTextBlock;
    }

    public override string JournalEntryName
    {
        get
        {
            return "Journal Entry " + this.dateCreated;
        }
    }

    public override void Replay(NavigationService navigationService, NavigationMode mode)
    {
        this.dateTextBlock.Text = this.dateCreated;
    }
}

Imports System.Windows.Controls
Imports System.Windows.Navigation
<Serializable>
Public Class MyCustomContentState
    Inherits CustomContentState
    Private dateCreated As String
    Private dateTextBlock As TextBlock

    Public Sub New(ByVal dateCreated As String, ByVal dateTextBlock As TextBlock)
        Me.dateCreated = dateCreated
        Me.dateTextBlock = dateTextBlock
    End Sub

    Public Overrides ReadOnly Property JournalEntryName() As String
        Get
            Return "Journal Entry " & Me.dateCreated
        End Get
    End Property

    Public Overrides Sub Replay(ByVal navigationService As NavigationService, ByVal mode As NavigationMode)
        Me.dateTextBlock.Text = Me.dateCreated
    End Sub
End Class

설명

기본적으로 NavigationService 탐색 기록의 콘텐츠 개체의 인스턴스를 저장 하지 않습니다. 대신 NavigationService 탐색 기록을 사용 하 여 탐색할 때마다 콘텐츠 개체의 새 인스턴스를 만듭니다. 이 동작은 큰 숫자 및 대규모 콘텐츠를 탐색할 때 과도 한 메모리 소비를 방지 하도록 설계 되었습니다. 따라서 콘텐츠 상태는 다음 탐색 간에 기억 되지 않습니다. 그러나 WPF는 사용자 지정 상태의 일부를 콘텐츠의 탐색 기록 항목과 연결하는 기능을 제공합니다.

탐색 기록 항목과 연결된 사용자 지정 상태는 파생 CustomContentState되는 클래스여야 합니다. 다음 기술 중 하나를 사용하여 개체를 탐색 기록 항목과 연결 CustomContentState 합니다.

참고

AddBackEntry 메서드를 호출하는 경우 탐색 이벤트를 처리하거나 구현IProvideCustomContentState해야 합니다.

탐색 기록 항목을 탐색할 때 WPF는 사용자 지정 CustomContentState 개체가 연결되어 있는지 확인합니다. 이 경우 사용자 지정 CustomContentState 개체가 이전 탐색에서 기억한 상태를 적용할 수 있도록 호출 Replay 합니다.

사용자 지정 CustomContentState 클래스는 개체가 연결된 탐색 기록 항목에 표시되는 이름을 변경하도록 재정 JournalEntryNameCustomContentState 할 수 있습니다. 반환되는 JournalEntryName 값은 다양한 탐색기의 탐색 UI에서 볼 수 있습니다(Internet Explorer 7, NavigationWindow, Frame).

파생 CustomContentState 되는 클래스는 직렬화할 수 있어야 합니다. 즉, 최소한 확대 SerializableAttribute하고 필요에 따라 구현 ISerializable해야 합니다.

중요

사용자 지정 콘텐츠 상태에 정보를 저장하는 경우 메모리에 콘텐츠를 유지하지 않으려는 경우 상태를 기억하고 있는 페이지의 인스턴스에 대한 참조를 저장할 수 없습니다. 이렇게 하면 WPF에서 페이지 인스턴스를 해제할 수 없으며 기본 탐색 기록 동작의 목적이 무효화됩니다. 이 작업을 수행해야 하는 경우 대신 사용하는 KeepAlive 것이 좋습니다.

생성자

CustomContentState()

CustomContentState 클래스의 새 인스턴스를 초기화합니다.

속성

JournalEntryName

탐색 기록에 저장되는 콘텐츠의 이름입니다. JournalEntryName 값은 Internet Explorer 7 탐색 UI에서 FrameNavigationWindow표시되고 Windows.

메서드

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
Replay(NavigationService, NavigationMode)

탐색이 발생할 때 콘텐츠에 상태를 다시 적용하기 위해 호출됩니다.

ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상

추가 정보