Answer the question
In order to leave comments, you need to log in
How to display the value of a variable in another xamarin page?
MainPage c# (Here I am passing an array):
[DesignTimeVisible(false)]
public partial class MainPage : ContentPage
{
private MyContext context { get; }
public MainPage()
{
InitializeComponent();
context = new MyContext();
this.BindingContext = context;
}
private async void OnNoteAddedClicked(object sender, EventArgs e)
{
ViewModels.Item[] valueName = context.Items;
await Navigation.PushAsync(new ResultPage(valueName));
}
}
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ResultPage : ContentPage
{
Item[] _Items;
public ResultPage(Item[] Items)
{
_Items = Items;
InitializeComponent();
}
}
<Button
Grid.Row="1"
Grid.Column="1"
BindingContext="{Binding Items[0]}"
Text="{Binding Value}" />
<Label
Grid.Row="1"
Grid.Column="2"
HorizontalTextAlignment="Center"
BindingContext="{Binding Items[1]}"
Text="{Binding Value}" />
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question