XAML Page Label static

JessaJessa TRMember ✭✭
edited June 2017 in Xamarin.Forms

hi,

i have a label in xaml page. i need change this label text in another page. How can I make this label static?

Thanks

Posts

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭
    edited June 2017

    GAWD no. Horrible violation of practices and so on.

    If you want, bind the label text to a property on you ViewModel.

    But under no circumstances should one page know anything about another page - nor UI elements be visible publically... Or static... Or any of that other1996 WinForms way of coding.

    PLEASE PLEASE PLEASE... Just stop what you're doing. Work the Xamarin tutorials and learn to do things corrently in 2017.
    To get you started you can see a quick overview here: http://wwwRedPillXamarin.com
    But you clearly need to get up to speed through Xamarin University.

  • Xami3Xami3 PKMember, University ✭✭✭

    @MikeEBB yes @ClintStLaurent is right this is a very bad idea. what you should do is attach viewmodel to your first page and then wither pass that viewmodel object to second page(which i dont like as well) or use messaging and pass data to first page. and in the messaging event update either the label in ui thread or update the property on the viewmodel

  • JessaJessa TRMember ✭✭

    @ClintStLaurent and @Xami3 thanks for your help and concern. I know using model, but I wanted to ask if there was any other way

Sign In or Register to comment.