Forum Xamarin Xamarin.Forms

C# Xamarin How to update a static string in a label

HubiiHubii Member ✭✭

i want to update a label with a static string. Thats my actual Code

public partial class MainPage : INotifyPropertyChanged
private static String _uploadstring;

/// A static property which you'd like to bind to

public static String Uploadstring
return _uploadstring;

        _uploadstring = value;


and i want call it with

    Device.BeginInvokeOnMainThread(async () =>
        Uploadstring = "TEEEEEEST";

here is my XAML Binding

   <Label Text="{Binding Source={x:Staticlocal:MainPage.UploadString}}" x:Name="ttts"  TextColor="Red" TranslationY="50" HeightRequest="30" FontSize="26" HorizontalOptions="Center"/>

If i set i breakpoint i see that the Uploadstring is updated in my XAML. But he dont display it because he dosent update the text. How can i solve my problem?

Best Answer


  • amirvenusamirvenus USMember ✭✭✭

    You need to call PropertyChanged?.Invoke() method inside the setter.

Sign In or Register to comment.