I Was trying to practice Navigation service in Wpf and I am getting the following error
‘Inkpad.Window1’ does not contain a definition for ‘NavigationService’
and no extension method ‘NavigationService’ accepting a first argument
of type ‘Inkpad.Window1’ could be found (are you missing a using
directive or an assembly reference?)
I have added the assembly file using System.Windows.Navigation; and tried using a <navigationWindow> in the xaml, but got an error again saying I cant use it directly, which I didnt follow.
and the code I have added in my .cs is
private void button4_Click(object sender, RoutedEventArgs e)
{
this.NavigationService.Refresh();
}
Can any one please let me know how to over come this?
You should use the static method NavigationService.GetNavigationService:
Get more info on navigation in Navigation Overview.