docs icon indicating copy to clipboard operation
docs copied to clipboard

NavigationService error

Open kingshez021 opened this issue 7 years ago • 2 comments

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 '' could be found (are you missing a using directive or an assembly reference ?)

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>

kingshez021 avatar Feb 18 '19 15:02 kingshez021

Where are you seeing this @kingshez021?

mairaw avatar Feb 19 '19 22:02 mairaw

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.

mairaw avatar Apr 22 '19 21:04 mairaw