Forum Xamarin Cross Platform with Xamarin

Change the text with a function in xaml

Is it possible to do text="getname(1)" in the xaml file ?
Where get name is a function the return a string ?


  • Sumit_SharmaSumit_Sharma USMember ✭✭✭

    I think you want to change the Label text from .cs file.

    Yes it is possible

    give your label an x:name = "label1" attribute in the label you want to change the text

    then save xaml file

    if you getname() returns string
    then use this is .cs file

    label1.Text = getname(1);

  • JesusAntonJesusAnton USMember ✭✭

    en xml se tiene que trabajar con Text={Binding texto, Mode=TwoWay}

Sign In or Register to comment.