Share via


Frame.GoForward Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Navigates to the most recent entry in the forward navigation history, or throws an exception if no entry exists in forward navigation.

Namespace:  System.Windows.Controls
Assembly:  System.Windows.Controls.Navigation (in System.Windows.Controls.Navigation.dll)

Syntax

'Declaration
Public Sub GoForward
public void GoForward()

Exceptions

Exception Condition
InvalidOperationException

There are no entries in the forward navigation history.

Remarks

The GoForward method throws an InvalidOperationException exception if there are no entries in the forward navigation history. To determine whether there is at least one entry in the forward navigation history, check the value of the CanGoForward property.

Examples

The following example shows event handler code for buttons on a frame that allow forward and back navigation.

Private Sub BackNavButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
    If (ContentFrame.CanGoBack) Then
        ContentFrame.GoBack()
    End If
End Sub

Private Sub ForwardNavButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
    If (ContentFrame.CanGoForward) Then
        ContentFrame.GoForward()
    End If
End Sub
private void BackNavButton_Click(object sender, RoutedEventArgs e)
{
    if (ContentFrame.CanGoBack)
    {
        ContentFrame.GoBack();
    }
}

private void ForwardNavButton_Click(object sender, RoutedEventArgs e)
{
    if (ContentFrame.CanGoForward)
    {
        ContentFrame.GoForward();
    }
}

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.