Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Can I create a StackLayout in F#?

$
0
0

In his Xamarin 3 F# Awesomeness blog posting, Dave Thomas shows a StackLayout being created:

StackLayout.Create(
            [ 
              Entry (Placeholder = "Username") 
              Entry (Placeholder = "Password", IsPassword = true) 
              Button (Text = "Login", TextColor = Color.White, BackgroundColor = Color.FromHex "77D065") 
            ],...

However, I get an error The field, constructor or member 'Create' is not defined

If I take out the 'Create before the parens, the error message changes to The member of object constructor 'StackLayout' takes 0 arguments but is here given 1.

My interpretation is that Create is a static method taking a tuple but I can't see it defined anywhere in the assembly browser.
I'm also a bit bothered in his sample by a lowercase create being used on TabbedPage so it looks like the code is inconsistent and possibly typed in without compiling, although he shows screenshots below.

I am a very experienced C++ and Python programmer learning F# (and Swift) so I'm likely to stumble over syntax. I get tuples, I'm getting used to the weird role of commas and thankfully my Python background made me relaxed about whitespace.

Someone else had the same question in the comments on the blog post but no answer was posted.

I am using Xamarin.iOS 8.10.0.258
Xamarin.Forms 1.4.0.6341

thanks

Andy


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>