The reason Intellisense is not displayed in the editor is because Xamarin XAML does not open as a file with the xaml content type, but a file with the xml content type .
To open the xamarin XAML file as a file with the content type xaml, simply in the solution browser, right-click the xaml file and select Open with .... From the pop-up menu, select "XAML Designer Encoding." and click OK .
Below is the solution if you are editing Xamarin xaml as a file with xml content type. But this solution is wrong, IntelliSense does not always offer the right solution.
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 by Visual Studio in two ways:
- You can use the xsd file and this file, and then register in xml-schemes - after you open the xaml file, the Xml / Schemas menu will appear.
- This definition can be created using the assembly attribute XmlnsDefinitionAttribute . This attribute can be found in the Portable.Xaml nuget package.
Suitable for Xamarin.Forms - the second way (using the attribute).
If you use Xaml in a portable library, restore (download and install) this nuget package to this library.
If you are using a shared project, restore this nuget package for all projects referencing this shared project.
Then paste this attribute in the appropriate place. I believe that App.xaml.cs (if you use the generated App name) is a good place. The code might 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, it seems to me, may not be practical for Intellisense for Xamarin.Forms to work. C>
Stefan babos
source share