42

Xamarin 3.0 introduced Xamarin.Forms, a powerful UI abstraction that allows developers to easily create user interfaces that can be shared across Android, iOS, and Windows Phone.

It seems very powerful but I'm facing a few difficulties to create UI as Xamarin.Forms comes with more than 40 controls. Without intellisense or a minimalist designer, it's fairly counter-productive to search for all properties in the official doc or by browsing c# code.

The default Xaml teamplate is like this, and it's clearly not trivial to add new controls without any help.

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
                       xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                       x:Class="App1.Class1">
    <Label Text="{Binding MainText}"  VerticalOptions="Center" HorizontalOptions="Center" />
</ContentPage>

So is there any chance to have intellisense inside Xaml or to use the Xaml designer ?

Brandon Minnick
  • 13,342
  • 15
  • 65
  • 123
Cybermaxs
  • 24,378
  • 8
  • 83
  • 112
  • `and it's clearly not trivial to add new controls without any help` - I `guess` this is targeted towards developers which previous XAML knowledge? I don't see how it is "not trivial" to add controls there. Just modify the XAML and add some container (They have several layout containers) and start adding controls in it. – Federico Berasategui Jun 10 '14 at 19:42
  • 6
    BTW, it is **AWESOMEEEEE** to see `{Binding}` in there. This means that Xamarin's XAML is closer to *real* XAML than I thought. – Federico Berasategui Jun 10 '14 at 19:43
  • 2
    ok, it's trivial to add content like editing any xml-based file. I just want to say it's not easy to add new controls as Xaml is case-sensitive and Xamarin.Forms introduced new controls (so new properties). It's a completely new set of controls. – Cybermaxs Jun 10 '14 at 19:56
  • hmm.. at least you should get Visual Studio's default XML intellisense if you have the appropriate schema (XSD) for that namespace `"http://xamarin.com/schemas/2014/forms"`... have you tried opening the file in VS's XML editor? – Federico Berasategui Jun 10 '14 at 19:59
  • [Xamarin.Forms](http://www.nuget.org/packages/Xamarin.Forms/) is a nuget package and I don't find the schema locally. I can open the xaml using XML designer, but I have the same intellisense-less experience. – Cybermaxs Jun 11 '14 at 07:38
  • @HighCore: it's not *close* to real XAML. It *is* real XAML. – Stephane Delcroix Jun 11 '14 at 08:27
  • @StephaneDelcroix if Xamarin.Forms is *real* XAML, that's awesome, seriously. But I would also like an official list of supported XAML features. There's much more in XAML than just `{Binding}`, there's `{RelativeSource}`, Styling, Templating, Behaviors, Triggers/DataTriggers and so on... – Federico Berasategui Jun 11 '14 at 11:45
  • 1
    @HighCore: XAML is a language. {Binding} is not part of the language, it's a markup extension. Styling, Templating, etc... are _not_ part of the XAML spec. That does not mean they're not or won't be supported in Xamarin.Forms. THIS (http://msdn.microsoft.com/en-us/library/ms788723(v=vs.110).aspx) is xaml, nothing more. – Stephane Delcroix Jun 11 '14 at 13:18
  • @StephaneDelcroix yes, sorry, maybe I expressed myself in a wrong way. My point is that most (all?) XAML-enabled frameworks (WPF, Silverlight, WinRT) share this feature set. In a technical way, yes XAML is nothing but the language itself, but in a practical way, what I'd call *real* XAML would be as close to the WPF feature set as possible (which is the richest one). – Federico Berasategui Jun 11 '14 at 13:26
  • @HighCore so I'd say it's quite close, and closer everyday. – Stephane Delcroix Jun 11 '14 at 13:32
  • @StephaneDelcroix that's **awesome** news. That means my dream of a cross-platform mobile WPF is becoming true now, thanks to the Xamarin Team. BTW do you work for Xamarin? – Federico Berasategui Jun 11 '14 at 13:36
  • @HighCore there is no intellisense for Xamarin Forms XAML, even if you have that namespace added; and it is not trivial because Xamarin has completely different sets of controls an extensions to the XAML language than, say, WPF or Silverlight, for example. -- There is no XML schema file provided either, you literally have to do it all blind. -- Knowing XAML helps, but it's definitely not trivial. – BrainSlugs83 Oct 12 '16 at 17:20
  • I think I have found the [Solution](http://stackoverflow.com/questions/41944444/intellisense-for-xaml-files-xamarin-forms). – RoloffM Jan 30 '17 at 23:26
  • I think I've found [the solution](http://stackoverflow.com/questions/41944444/intellisense-for-xaml-files-xamarin-forms) – RoloffM Feb 02 '17 at 10:03
  • I know this might be already too late but there are still people struggling with intellisense in xamarin.forms but here is the solution that worked for me and many other of my colleagues: http://stackoverflow.com/questions/41944444/intellisense-for-xaml-files-xamarin-forms I hope this will help other people who are googling right now to find a solution. I found the solution on google page 7.. and you know what they say about google: If it's not within the first 3 pages, it doesn't exist. I proved them wrong. – RoloffM Mar 05 '17 at 14:45
  • According to this post from Microsoft documentation, the preview feature is now available : [XAML Previewer for Xamarin.Forms](https://learn.microsoft.com/en-us/xamarin/xamarin-forms/xaml/xaml-previewer?tabs=windows) So I think the designer must not be that far away, also there are some additional extensions like [liveXAML](https://www.livexaml.com/) – Masoud Tahmasebi Feb 11 '19 at 06:36

9 Answers9

18

Xamarin.Forms does not come with a graphical designer (yet ?). As for intellisense there are 2 parts:

  • referencing xaml element tagged with x:Name in code behind works in both Xamarin.Studio and VisualStudio
  • Xaml completion of elements and attributes works in Xamarin.Studio, and support for completing attributes values is coming very soon. Unfortunately, intellisense for Xaml in VisualStudio does not work for now. But the problem is well known, and solutions are investigated.
Stephane Delcroix
  • 16,134
  • 5
  • 57
  • 85
6

I have had success with Xamarin.Forms Intellisense extension in a PCL but not SAP.

enter image description here

ClintL
  • 1,424
  • 14
  • 30
  • 1
    I also intellisense now for Xamarin.Forms xaml files in a PCL project. see this link for installation instructions http://www.cazzulino.com/mobileessentials.html – MemeDeveloper Feb 09 '15 at 12:44
  • It worked for a day (with the poorest Xaml intellisense I've ever seen). But when I restarted Visual Studio it no longer worked anymore. – BrainSlugs83 Oct 12 '16 at 17:21
5

Intellisense has been released in its first form, more information here:

Mobile Essentials: Productivity Tools for Mobile Developers

Ajay Sharma
  • 2,881
  • 5
  • 22
  • 32
  • 3
    Also if you use Resharper, it now implements Intellisense for Xamarin.Forms – Kym Phillpotts Mar 01 '15 at 02:29
  • Ya. That is what I said last month. – ClintL Mar 13 '15 at 14:53
  • +1 for resharper - even though it's commercial, given the price of Xamarin.Forms for visual studio at $1000/y, resharper's $149/y is a decent addition if you didn't already own it. Most other alternatives are a waste of time. – Max Apr 28 '15 at 04:48
4

Xamarin Studio 6.1+ includes a XAML previewer:

enter image description here

It is not perfect, but as a "preview" release does a decent job of rendering your XAML in different resolutions on iOS and Android, including different orientations.

A registration required video: https://brax.tv/lesson/xamarin-forms-hello-xaml-previewer/

Xamarin Evolve Videos @ https://evolve.xamarin.com

(Official Evolve video at the time of this posting are not online yet)

SushiHangover
  • 73,120
  • 10
  • 106
  • 165
1

If you have Resharper 9, then intellisense works in Visual Studio, with the Xamarin.Forms Intellisense extension mentioned by Clint Landry.

Caitlin
  • 738
  • 6
  • 9
1

A 3rd-Party company is developing a Xamarin.Forms Designer called UI Sleuth.

They are still in stealth-mode, but have posted a couple of demo videos:

I recommend following the Lead Architect on Twitter. This is where they are posting the latest UI Sleuth updates!

Brandon Minnick
  • 13,342
  • 15
  • 65
  • 123
0

All that is needed to implement Intellisense on VS is have the Xamarin.Forms XAML schema in a .xsd file placed in the proper folder of visual studio at the installation time. I guess the NuGet package/tasks don't have at the installation time and the access required by the OS(unless you run Visual Studio as Admin and hardcoded paths into NuGet package install tasks, which is not good idea) to do it.

I've throw this same question to Xamarin team and they replied that the Intellisense is yet to come in following updates and the designer in a future(don't know how soon, even for the alpha/beta channels of update).

Hope it helps...

Gutemberg Ribeiro
  • 1,533
  • 1
  • 21
  • 45
  • Xamarin team said that is working on it... No updates from then... You can follow the bug from here: https://bugzilla.xamarin.com/show_bug.cgi?id=20955 – Gutemberg Ribeiro Jul 18 '14 at 23:44
0

I've just read a tweet about a Xamarin.Forms Designer being announced at Xamarin Evolve 2016 conference

In the mean time you could use the Windows Phone designer and a converter to spit out Xamarin.Forms markup, see: http://www.gui-innovations.com/Blog%20Posts/windows-phones-forms-to-xamarin-forms.html

That tool is also mentioned at together with other related tools at: https://github.com/MvvmCross/MvvmCross-Forms/wiki/XAML-Tools-for-Xamarin

George Birbilis
  • 2,782
  • 2
  • 33
  • 35
0

enter image description here

I created two videos that cover how you can use Xamarin Studio's new XAML Previewer:

Intro:

Using Design Data:

Design Data with ViewModelLocator:

An example of the code involved:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
        xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
        x:Class="STLBrews.Mobile.BreweriesPage"     
        xmlns:vm="clr-namespace:STLBrews.ViewModels;assembly=STLBrews.ViewModels" 
        BindingContext="{x:Static vm:ViewModelLocator.BreweriesVM}">
    <ContentPage.Content>
        <ListView
            ItemsSource="{Binding Items}" >
            <ListView.ItemTemplate> 
                <DataTemplate>
                    <ViewCell>
                        <StackLayout Orientation="Horizontal">
                            <Image Source="{Binding LogoUrl}"/>
                            <StackLayout Orientation="Vertical" Spacing="0" VerticalOptions="Center">
                                <Label Text="{Binding Name}" FontAttributes="Bold"/>
                                <Label Text="{Binding Description}" FontSize="10"/>
                            </StackLayout>
                        </StackLayout>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </ContentPage.Content>
</ContentPage>
pppery
  • 3,731
  • 22
  • 33
  • 46
Ben Bishop
  • 1,414
  • 9
  • 14