Споделяне чрез


Text in Xamarin.Forms

Using Xamarin.Forms to enter or display text.

Xamarin.Forms has three primary views for working with text:

  • Label — for presenting single or multi-line text. Can show text with multiple formatting options in the same line.
  • Entry — for entering text that is only one line. Entry has a password mode.
  • Editor — for entering text that could take more than one line.

Text appearance can be changed using built-in or custom styles and some controls support custom fonts.

Label

The Label view is used to display text. It can show multiple lines of text or a single line of text. Label can present text with multiple formatting options used in inline. The label view can wrap or truncate text when it can't fit on one line.

Label Example

See the Label article for more detailed information.

For information on customizing the font used in a label, see Fonts.

Entry

Entry is used to accept single-line text input. Entry offers control over colors and fonts. Entry has a password mode and can show placeholder text until text is entered.

Entry Example

See the Entry article for more information.

Note that, unlike Label, Entry cannot have custom font settings.

Editor

Editor is used to accept multi-line text input. Editor offers control over colors and fonts.

Editor Example

See the Editor article for more information.

Fonts

Many controls support different font settings using the built-in fonts on each platform, or custom fonts included with your app. See the Fonts article for more detailed information.

Styles

Refer to working with styles to learn how to set up font, color, and other display properties that apply across multiple controls.