This repository has been archived by the owner on Nov 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 562
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Craig
committed
Jul 20, 2019
1 parent
b365540
commit 983869f
Showing
3 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
name: 'Xamarin.Forms Book - VariableFormattedText F#' | ||
description: "Xamarin.Forms app with formatted text spans, written in F#" | ||
page_type: sample | ||
languages: | ||
- fsharp | ||
products: | ||
- xamarin | ||
urlFragment: chapter03-fs-variableformtext | ||
--- | ||
# Greetings F\# | ||
|
||
Simple Xamarin.Forms application written in F#, showing formatted text spans: | ||
|
||
```fsharp | ||
type VariableFormattedTextPage() = | ||
inherit ContentPage() | ||
let formattedString = FormattedString() | ||
let largeSize = Device.GetNamedSize(NamedSize.Large, typeof<Label>) | ||
do formattedString.Spans.Add(Span(Text = "I ")) | ||
do formattedString.Spans.Add(Span(Text = "love", | ||
FontSize = largeSize, | ||
FontAttributes = FontAttributes.Bold)) | ||
do formattedString.Spans.Add(Span(Text = " Xamarin.Forms")) | ||
do base.Content <- Label(FormattedText = formattedString, | ||
VerticalOptions = LayoutOptions.Center, | ||
HorizontalOptions = LayoutOptions.Center, | ||
FontSize = largeSize) | ||
``` |