[Solved] Trying to change a Label from two enteries when Button pressed and display on another page? | Xamarin | C# [closed]


If you mean enter text in two labels is the enter text in two entrys . Here is a sample for reference :

PageA – Xaml :

<Entry x:Name="entryone"/>
<Entry x:Name="entrytwo"/>
<Button Text="Push" Clicked="Button_Clicked"/>

ContentPage – Button_Clicked :

private void Button_Clicked(object sender, EventArgs e)
{
      SecondPage secondPage = new SecondPage();
      secondPage.previousPageValue = entryone.Text + entrytwo.Text; //Set value to next page
      Navigation.PushAsync(secondPage);
 }

PageB – Xaml :

<Label x:Name="label"/>

ContentPage – show value when page OnAppearing ;

public partial class SecondPage : ContentPage
{
    public string previousPageValue; //Declare here

    public SecondPage()
    {
        InitializeComponent();
    }

    protected override void OnAppearing()
    {
        base.OnAppearing();
        label.Text = previousPageValue;
    }
}

First Page Second Page

4

solved Trying to change a Label from two enteries when Button pressed and display on another page? | Xamarin | C# [closed]