locked
Squiggly Lines in Visual Studio 2013 RRS feed

  • Question

  • I am developing a WinRT app in Visual Studio 2013. I declare some controls in XAML and name them, but when I go to code behind and try to reference them, I get squiggly lines saying "the control is not available in the current context". Even this.InitializeComponent() is underlined saying "MainPage.cs does not have a definition for InitializeComponent()".

    Anyone has clue what is going on and how to solve it?

    Thanks.


    The best things in life are free, but the most valuable ones are costly...use opportunities well for there are others like you who deserves them, but don't have them...

    Wednesday, November 27, 2013 9:55 PM

Answers

  • Hi,

    You can rebuild your project. This is an intellisense problem between UI and code-

    behind. You can go to this link to post your problem and suggestion:

    https://connect.microsoft.com/

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Tuesday, December 3, 2013 9:05 AM

All replies

  • There is probably a mismatch with your class namespaces. Check to make sure that the namespace being used in the XAML file is the same as the .cs file.
    Wednesday, November 27, 2013 11:36 PM
  • Hi,

    You don't give enough information, but I assume
    your problem occurs when you try to reference controls which in a DataTemplate.

    You can refer to the link to get more information
    about why you cannot reference the controls:

    http://social.msdn.microsoft.com/Forums/windowsapps/en-US/b5711427-bced-44fa-b8ce-ca7bf38bec60/xaml-xname-issue?forum=winappswithcsharp

    Best Wishes!



    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    • Edited by Anne Jing Thursday, November 28, 2013 5:39 AM edit
    Thursday, November 28, 2013 5:38 AM
  • Hi

    I have the same problem here.

    It seems to be a Intellisense problem, because the project builds fine. The problem appears in the code-behind CS file: every methods and fields defined in the *.g.i.cs file are not recognized in the *.cs file, and therefore are underlined

    No idea how to solve it...

    Cédric

    Thursday, November 28, 2013 11:05 AM
  • Bingo!

    That is exactly what is happening. Have you found a solution?


    The best things in life are free, but the most valuable ones are costly...use opportunities well for there are others like you who deserves them, but don't have them...

    Monday, December 2, 2013 12:04 AM
  • Hi,

    You can rebuild your project. This is an intellisense problem between UI and code-

    behind. You can go to this link to post your problem and suggestion:

    https://connect.microsoft.com/

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Tuesday, December 3, 2013 9:05 AM
  • Hi,

    I've already rebuild my project many times. Sometime (but not always), that effectively temporary solve this problem. But at the next build, the underlines come back.

    This is not a blocking issue, it is just annoying... I'm going to post this problem on Connect.

    Thank you

    Cédric

    Tuesday, December 3, 2013 9:12 AM
  • The same thing happens to my installation.  In fact, I posted about it in the Tools Forum just yesterday:

    IntelliSense does not always work

    This was not a problem before the update to Windows 8.1/VS2013.

    As you say, it is very annoying.

    Tuesday, December 3, 2013 12:50 PM