방법: 탐색 기록을 통해 앞으로 탐색
이 예제에서는 전방 탐색 기록의 항목을 탐색하는 방법을 보여 줍니다.
예제
NavigationWindow에서 호스팅되는 콘텐츠에서 실행되는 코드인 Frame에서 NavigationService를 사용하거나 Windows Internet Explorer에서 탐색 기록의 앞쪽으로 한 번에 한 항목씩 탐색할 수 있습니다.
한 항목 앞으로 탐색하려면 GoForward 메서드를 호출하여 한 항목 앞으로 탐색하기 전에 먼저 CanGoForward 속성을 검사하여 전방 탐색 기록에 항목이 있는지 검사해야 합니다. 다음 예제에서 이 과정을 보여 줍니다.
Private Sub navigateForwardButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
' Navigate forward one page from this page, if there is an entry
' in forward navigation history
If Me.NavigationService.CanGoForward Then
Me.NavigationService.GoForward()
Else
MessageBox.Show("No entries in forward navigation history.")
End If
End Sub
void navigateForwardButton_Click(object sender, RoutedEventArgs e)
{
// Navigate forward one page from this page, if there is an entry
// in forward navigation history
if (this.NavigationService.CanGoForward)
{
this.NavigationService.GoForward();
}
else
{
MessageBox.Show("No entries in forward navigation history.");
}
}
CanGoForward 및 GoForward는 NavigationWindow, Frame 및 NavigationService로 구현됩니다.
참고 |
---|
GoForward를 호출할 때 전방 탐색 기록에 항목이 없으면 InvalidOperationException이 발생합니다. |