Answers for "C# xamaring form change text on label"

C#
0

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
    }
}
Posted by: Guest on July-31-2020

Code answers related to "C# xamaring form change text on label"

C# Answers by Framework

Browse Popular Code Answers by Language