locked
Listview Navigation RRS feed

  • Question

  • User386612 posted

    I am making a contact app. I want to have a list of departments and when you select a department it navigates to a list of employees in that department and from there navigates to details about the selected employee. I am pulling the employees from a json url. I can't find anything on how to do this and how to display only the employees in that department when that department is selected. Any help or examples would be greatly appreciated.

    Thursday, June 13, 2019 8:17 PM

All replies

  • User180523 posted

    Xamarin documentation on Navigation https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/navigation/

    Thursday, June 13, 2019 8:20 PM
  • User200920 posted

    @grayson_alexander, You can use the LINQ for select and filer the employees collection. You will get the departments from the collection like below, var departments = collections.Select(x => x.Department).Distinct(); And you can filter with Where methods like below, var employees = collections.Where(x => x.Department.equals(selectedDepartment)); Finally, You use FirstOrDefault method to get the specific employee from the collection.

    Friday, June 14, 2019 6:08 AM
  • User386612 posted

    @FaizalSaidali thank you! Do you know if there are any examples of this being used that I could look at?

    Friday, June 14, 2019 1:37 PM
  • User200920 posted

    @grayson_alexander , LINQ is one of the best programming concept in .NET framework. You will get millions of examples from simple google search. I don't know how to take a good drop off the ocean :smile:

    Monday, June 17, 2019 5:40 AM