Forum Xamarin.Mac

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

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; .....it's not updating the label value?

Best Answer

Answers

  • codergcoderg Member ✭✭

    added the following code in ViewControlller.cs

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

Sign In or Register to comment.