Cannot get Xamarin Xaml Intellisense working in VS 2015

前端 未结 10 2210
遇见更好的自我
遇见更好的自我 2020-12-07 01:18

I\'ve been trying to get intellisense working for quite some time now, and am unable to see anything outside of

!
![CDATA[
?
  • Visual
相关标签:
10条回答
  • 2020-12-07 02:02

    I have Resharper installed on VS2015update3, and XAML Designer didn't work for me.

    But accidently I found XML (Text) Editor works. That's Resharper that makes effet.

    • No wave-line beneath the tag
    • Perfect prompt everywhere: XML Tags, Properties, available Values

    Only things: it doesn't color too much, and F7 do not send me to its code-behind.

    Voilà, hope this could help

    0 讨论(0)
  • 2020-12-07 02:06

    worked for me Right click on Your XAML file and choose Option Open With=>Source Code(Text) Editor with Encoding=>Set as default=>Apply and choose option Auto....

    0 讨论(0)
  • 2020-12-07 02:12

    The reason why Intellisense is not appear in editor is that Xamarin XAML is not opened as file with content type xaml but file with content type xml.
    To open xamarin XAML file as file with content type xaml simply in solution explorer right click the xaml file and select Open With... In popup select "XAML Designer with Encoding" and click OK.


    Solution below is if you edit Xamarin xaml as file with content type xml. But this solution is not correct, IntelliSense then not always correctly suggests.

    To take advantage of Intellisense the Visual Studio must get appropriate definition of xml namespace for Xamarin.Forms. For the Xamarin.Forms Visual Studio needs xml definition for namespace http://xamarin.com/schemas/2014/forms.
    This definition can be provided to Visual Studio by two ways:

    1. You can use xsd file and this file then register to xml schemas - after you open xaml file, the menu Xml/Schemas appear.
    2. You can this definition create by assembly attribute XmlnsDefinitionAttribute. This attribute you can found in Portable.Xaml nuget package.

    Suitable for Xamarin.Forms is the second way(using attribute).

    If you use Xaml in portable library, restore(download and install) this nuget package to this library.
    If you use shared project, then restore this nuget package to all projects referencing this shared project.

    Then insert this attribute to appropriate place. I believe that the App.xaml.cs(if you use generated name App) is a good place. The code could look like this:

    using Portable.Xaml.Markup;
    using Xamarin.Forms;
    
    [assembly: XmlnsDefinition("http://xamarin.com/schemas/2014/forms", "Xamarin.Forms")]
    
    namespace YourAppNamespace
    {
        public partial class App : Application
        {
            public App ()
            {
                this.MainPage = new MainPage();
            }
        }
    }
    

    And the rebuild solution, as I believe, might not be necessary to work Intellisense for Xamarin.Forms.

    0 讨论(0)
  • 2020-12-07 02:13

    I resolved this issue by doing a simple workaround and here is the solution.

    Right-click the XAML file in the Solution Explorer and select

    Solution 1: "Open With... > Source Code (Text) Editor".

    and in another time this also worked for me:

    Solution 2: "Open With... > Source Code (Text) Editor with Encoding"

    This workaround gave me the desired XAML IntelliSense even without installing the extra "Enable XAML Language for Xamarin.Forms" extension and even with ReSharper installed but suspended.

    0 讨论(0)
提交回复
热议问题