Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

C# xamaring form change text on label

// In XAML file
<Label Text="{Binding MyStringProperty}"
       .../>

// In CS file
public partial class MyTestPage : ContentPage
{
    private string myStringProperty;
    public string MyStringProperty
    {
        get { return myStringProperty; }
        set 
        {
            myStringProperty = value;
            OnPropertyChanged(nameof(MyStringProperty)); // Notify that there was a change on this property
        }
    }

    public MyTestPage()
    {
        InitializeComponents();
        BindingContext = this;

        MyStringProperty = "New label text"; // It will be shown at your label
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #xamaring #form #change #text #label
ADD COMMENT
Topic
Name
3+8 =