set and get values on tabbed pages

Hi!

I'm a rookie in programming with xamarin, so please be kind with me ;-).

I use tabbed pages vor my little app (just a test).

<?xml version="1.0" encoding="UTF-8" ?> <TabbedPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:MaSuTo" x:Class="Tabbed_Test.Main_Tabbed"> <local:page1></local:page1> <local:page2></local:page2> </TabbedPage>

On page2 you can select some stuff. I want to display the selection from page2 on page1 (in a label). Therefor I (try to) set my values in a public class (Save_Data_Class).

Save_Data_Class save_data = new Save_Data_Class(); save_data.Save_Picker1=Pck_1.SelectedItem.ToString(); save_data.Save_Picker2=Pck_2.SelectedItem.ToString();

public class Save_Data_Class { public string Save_Picker1 { get; set; } public string Save_Picker2 { get; set; } }

And here is my xaml-code of page1

<?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Tabbed_Test.page1"> <ContentPage.Content> <StackLayout HorizontalOptions="Center" VerticalOptions="Center"> <Label x:Name="Lbl_1" Text="{Binding Save_Picker1}" /> <Label x:Name="Lbl_2" Text="{Binding Save_Picker2}" /> </StackLayout> </ContentPage.Content> </ContentPage>

Unfortunately page1 is blank... Do you have some hints for me?

Best Answers

  • MamagotchiMamagotchi ✭✭
    Accepted Answer

    @stemado said:
    Are you using any ViewModels with any of your Views, or is it all in the codebehind on the Views themselves?

    this is all.

    Right now I save my data in a csv-file and I can live with this compromise.

Answers

  • jezhjezh Member, Xamarin Team Xamurai

    Could you please post a basic demo?

  • stemadostemado Member ✭✭

    Are you using any ViewModels with any of your Views, or is it all in the codebehind on the Views themselves?

  • MamagotchiMamagotchi Member ✭✭
    Accepted Answer

    @stemado said:
    Are you using any ViewModels with any of your Views, or is it all in the codebehind on the Views themselves?

    this is all.

    Right now I save my data in a csv-file and I can live with this compromise.

Sign In or Register to comment.