-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Code-behind x:Name not linking properly #2574
Comments
|
I'm still wondering why one needs a field to be created for a x:Name on the root 🤷♂️ |
This is still an issue. This happened to specific file. After updating VS for mac to 8.9.5 (build 4) it started acting up. I can't assign names to any controls other than the ones that already had a name prior to the update. I had to manually add the name in the xaml.g.cs file. after restarting, the file was generated without the name and I was back at square one |
Yes, i am having this issue still while trying to access the mediaElement control by name in the code behind. It happens often for me with various control. I usually delete obj/bin folders and restart and the problem goes away but the mediaElement x:name doesn't want to work... |
I am also still having this issue. It seems to come and go. I have several other View's in Xamarin that I am able to properly reference in the code behind. But one class in particular keeps having this issue. I tried to use the name anyway, since it was said to be an Intellisense issue, but it will not let me proceed. |
This is unfortunately still an issue on MAUI too. |
Description
Cannot access named components from code-behind
Steps to Reproduce
Expected Behavior
Should run as expected
Actual Behavior
myTextLabel gives 'Not Available' error (shown in image)
myContentPage gives standard "myContentPage does not exist in current context"
Trying to run the code with just the myTextLabel referenced works as expected. Trying to run it with myContentPage referenced does not.
Basic Information
Screenshots
Here is the xaml, all blocked text is the same (Namespace name)
The text was updated successfully, but these errors were encountered: