Home > Software design >  How to read the returned value in uwp
How to read the returned value in uwp

Time:01-03

I have a list and and i need the listvalues to get in another page I don't know how to read the list values.

EXAMPLE in frame1 I have a list I returned the list to frame2 but I don't know how to read the list in frame2.

My code is:

private void EmployeeListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
 List<EmployeeItem> trainitem = new List<EmployeeItem>();
 EmployeeItem item = EmployeeListView.SelectedItem as EmployeeItem;
    
 if(item != null)
 {
  trainitem.Add(item);
 }
             
 Frame.Navigate(typeof(SelectTrainingPlan),trainitem);
}

I need to read the trainitem in the frame2 SelectTrainingPlan.

CodePudding user response:

On the SelectTrainingPlan page you can override a method OnNavigatedTo and get your list like

protected override void OnNavigatedTo(NavigationEventArgs e) 
{
    var yourList = e.Parameter as List<EmployeeItem>;
}
  • Related