Xamarin.Forms Book - Hello F#

Xamarin.Forms docs / eBook / Related samples

Simple Xamarin.Forms application for Android and iOS, written in F#:

type App() =
    inherit Application()

    let stack = StackLayout(VerticalOptions = LayoutOptions.Center)
    let label = Label(HorizontalTextAlignment = TextAlignment.Center,
                      Text = "Welcome to F# Xamarin.Forms!")
    do stack.Children.Add(label)
    do base.MainPage <- ContentPage(Content = stack)

Prerequisites

  • Visual Studio on Mac or Windows.
    • Mobile Development with .NET (Xamarin) workload installed.
    • F#
  • To test and deploy to iOS devices:
    • Mac computer with the latest version of macOS.
    • Latest version of Xcode from Apple on the Mac.
    • If you're using Windows, the Mac should be available on the network.

Running the sample

  1. Open the solution file (.sln) in Visual Studio.
  2. Use the Run button or menu to start the app.