How do I handle Back and Forward button click ?

Platform: WPF|Category: Navigation

Back and Forward button click can be handled using the ‘CommandBindings’ property of the ‘NavigationWindows’ class.

The following code snippet is used to handle the ’Back’ button click in a NavigationWindow.

[C#]

//after InitializeComponent()
navwindow1.CommandBindings.Add(new CommandBinding(NavigationCommands.BrowseForward, OnBrowseForward));

void OnBrowseBack(object sender, ExecutedRoutedEventArgs args)
{
MessageBox.Show('Back Button is Clicked');
}