NavigationService error
Before you open an issue
If the issue is:
- A simple typo or similar correction, you can submit a PR. See the contributor guide for instructions.
- A general support question, consider asking on a support forum site.
- A site design concern, create an issue at MicrosoftDocs/feedback.
- A problem completing a tutorial, compare your code with the completed sample.
- A duplicate of an open or closed issue, leave a comment on that issue.
Issue description
private void Button_Click(object sender, RoutedEventArgs e)
{
//View Expense Report
ExpenseReportPage expenseReportPage = new ExpenseReportPage(); //Line 1
this.NavigationService.Navigate(expenseReportPage); //Line 2
}
Line 2 in above code gives following error for NavigationService:
'<invalid-global-code' does not contain a definition for 'NavigationService' and no accessible extention method 'NavigationService' accepting the first argument of type '
I have added the using System.Windows.Navigation; I think the problem is coming from 'this' part of this.NavigationService.Navigate(expenseReportPage);
Please Help!
Thanks in advance.
Target framework
Check the .NET target framework(s) being used, and include the version number(s).
- [2.1 ] .NET Core
- [ 4.6.1] .NET Framework
- [x] .NET Standard
If using the .NET Core SDK, include dotnet --info output. If using .NET Framework without the .NET Core SDK, include info from Visual Studio's Help > About Microsoft Visual Studio dialog.
dotnet --info output or About VS info
<replace>
Where are you seeing this @kingshez021?
Closing this due to the lack of information @kingshez021. Please get back to us with information about the article where you're seeing this so we can follow up.