Passing data using Shell and remember it

Jassim Al Rahma 1,471 Reputation points


I am trying to pass data from Page-A to Page-B using the following:

In Page-A:

await Shell.Current.GoToAsync($"MemberDetails?MyMember=1000", true);  

and In Page-B:

[QueryProperty("Member", "MyMember")]  


private string member;  
public string Member  
    set { member = value; }  
    get { return member; }  

but when I try to display the value in Page-B using:

DisplayAlert("member", member, "Ok");  

It does not show any value.

Please see the attached sample.

Kindly help..


A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,205 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 25,046 Reputation points Microsoft Vendor


    No, there is no need to set another variable.

    Your issue is caused by that you set LabelParameter.Text = member; in your page constructor method.

    Therefore, your program will call LabelParameter.Text = member; at first, then call member = value; secondly.

    You could use the following ways to deal with the issue:

    Method 1:

    You could call LabelParameter.Text = member; in the setter method:

           member = value;   
           LabelParameter.Text = member;  

    Method 2:

    You could call LabelParameter.Text = member; in the OnAppearing method:

       protected override void OnAppearing()   
           LabelParameter.Text = member;  

    Best Regards,

    Alec Liu.

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    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.