Xamarin.Forms Guides | Samples

Xamarin.Forms.Entry Class

A control that can edit a single line of text.

See Also: Entry

Syntax

[Xamarin.Forms.RenderWith(typeof(Xamarin.Forms.Platform._EntryRenderer))]
public class Entry : InputView, IElementConfiguration<Entry>, IEntryController

Remarks

Entry is a single line text entry. It is best used for collecting small discrete pieces of information, like usernames and passwords.

The following example creates a new username and password set of entries.

C# Example

View CreateLoginForm ()
{
  var usernameEntry = new Entry {Placeholder = "Username"};
  var passwordEntry = new Entry {
    Placeholder = "Password",
    IsPassword = true
  };

  return new StackLayout {
    Children = {
      usernameEntry,
      passwordEntry
    }
  };
}

The FormsGallery sample, which can be found on the Sample Applications page, has an EntryDemoPage.cs file. This file contains a longer and more complicated example.

XAML for Xamarin.Forms supports the following properties for the Entry class:

PropertyValue
IsPasswordtrue to indicate that the Entry is a password field. Otherwise, false.
PlaceholderThe default text that will appear in the control.
Text

The initial text that will appear in the entry.

TextColor

A color specification, with or without the prefix, "Color". For example, "Color.Red" and "Red" both specify the color red.

Requirements

Namespace: Xamarin.Forms
Assembly: Xamarin.Forms.Core (in Xamarin.Forms.Core.dll)
Assembly Versions: 1.0.0.0, 1.1.0.0, 1.2.0.0, 1.3.0.0, 1.4.0.0, 1.5.0.0, 2.0.0.0

The members of Xamarin.Forms.Entry are listed below.

See Also: InputView

Public Constructors

Initializes a new instance of the Entry class.

Public Fields

static readonly
FontAttributesPropertyBindableProperty. Backing store for the FontAttributes property.
static readonly
FontFamilyPropertyBindableProperty. Backing store for the FontFamily property.
static readonly
FontSizePropertyBindableProperty. Backing store for the Entry.FontSize property.
static readonly
HorizontalTextAlignmentPropertyBindableProperty. Backing store for the HorizontalTextAlignment property.
static readonly
IsPasswordPropertyBindableProperty. Identifies the IsPassword bindable property.
static readonly
PlaceholderColorPropertyBindableProperty. Backing store for the Entry.PlaceholderColor property.
static readonly
PlaceholderPropertyBindableProperty. Identifies the Placeholder bindable property.
static readonly
TextColorPropertyBindableProperty. Identifies the TextColor bindable property.
static readonly
TextPropertyBindableProperty. Identifies the Text bindable property.

Public Properties

FontAttributesFontAttributes. Gets a value that indicates whether the font for the Entry element text is bold, italic, or neither.
FontFamilyString. Gets the font family for the Entry element text.
FontSizeDouble. Gets the size of the font for the Entry element text.
HorizontalTextAlignmentTextAlignment. Gets or sets the horizontal text alignment.
IsPasswordBoolean. Gets or sets a value that indicates if the entry should visually obscure typed text. This is a bindable property.
PlaceholderString. Gets or sets the placeholder text shown when the entry Entry.Text is null or empty. This is a bindable property.
PlaceholderColorColor. Gets or sets the color of the placeholder text.
TextString. Gets or sets the text of the entry. This is a bindable property.
TextColorColor. Gets or sets the Color for the text of the Entry. This is a bindable property.

Public Methods

On<T>() : IPlatformElementConfiguration<T, Entry>
Returns the platform-specific instance of this Entry, on which a platform-specific method may be called.

Public Events

CompletedOccurs when the user finalizes the text in an entry with the return key.
TextChangedEvent that is raised when the text in this Entry element is changed.

Explicitly Implemented Interface Members

Entry$IEntryController.SendCompletedThis interface is for internal use by platform renderers.