Forum Xamarin.Mac

How to update label values in ViewController.cs file

codergcoderg Member ✭✭

I have implemented a Timer class in the viewcontroller.cs. My timer is working as i can print the incremental values in Console. However if I am trying to show the same value in a label using mylabel.StringValue=counter;'s not updating the label value?

Best Answer


  • codergcoderg Member ✭✭

    added the following code in ViewControlller.cs

    InvokeOnMainThread(() =>
    myLabelOutlet.StringValue = c.ToString();

Sign In or Register to comment.