xamarinxamarin.formsreferencecode-behindxname

Accessing controls using C# code behind in Xamarin.Forms


I can't access a label defined in the xaml file from the code behind C# code.

I tried the x:name="l" property but it tells me that "'l' is not defined":

enter image description here

Could anyone help me how to access controls from C# code behind by providing an example?


Solution

  • what you're doing is correct, but the XF Intellisense is pretty flaky. Try restarting VS, and do a clean and build to see i that fixes it