Search code examples
c#uwptemplate10

What is NavigationServices.FirstOrDefault() of Template10 navigation service?


I want to navigate between pages in Template10. From the documentation, https://github.com/Windows-XAML/Template10/wiki/Services#navigationservice, the example is as follow

// from inside any window var nav = WindowWrapper.Current().NavigationServices.FirstOrDefault(); nav.Navigate(typeof(Views.DetailPage), this.Value);

Unfortunately WindowWrapper.Current().NavigationServices.FirstOrDefault() does not exist. What FirstOrDefault actually means?

Also, how do I navigate to other page from page.xaml.cs?


Solution

  • FirstOrDefault() is an extension method provided by LINQ. You need to add the line:

    using System.Linq;
    

    at the top of your file to get it.