Hello,
Welcome to our Microsoft Q&A platform!
My question is, is there a way to use the value collected in the first page from the QR code and have that has the header for the API call on the second page.
You could pass the value as a parameter when navigating to the second page.
public partial class FirstPage : ContentPage
{
public FirstPage()
{
InitializeComponent();
}
void functionMethod()
{
Navigation.PushAsync(new SecondPage(theValue));
}
}
public partial class SecondPage : ContentPage
{
string theResult;
public SecondPage(string result)
{
InitializeComponent();
theResult = result; //perform the work with the result in the page
}
}
Or save the value to the dictionary in the first and retrive it in the second page.
public partial class FirstPage : ContentPage
{
public FirstPage()
{
InitializeComponent();
}
void functionMethod()
{
Application.Current.Properties["Result"] = theCodeValue;
Navigation.PushAsync(new SecondPage());
}
}
public partial class SecondPage : ContentPage
{
string theResult;
public SecondPage()
{
InitializeComponent();
theResult = Application.Current.Properties["Result"] as string; ; //perform the work with the result in the page
}
}
Check the doc: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/application-class#properties-dictionary
Best Regards,
Jarvan Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.