mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-18 13:51:27 +08:00
37 lines
1.2 KiB
Markdown
37 lines
1.2 KiB
Markdown
---
|
|
nav-title: "TextField How-To"
|
|
title: "text-field"
|
|
environment: nativescript
|
|
description: "Examples for using TextField"
|
|
previous_url: /ApiReference/ui/text-field/HOW-TO
|
|
---
|
|
# TextField
|
|
Using a TextField requires the text-field module.
|
|
{%snippet require-textfield%}
|
|
### Binding two TextFields text property to observable view-model property.
|
|
```XML
|
|
<Page loaded="pageLoaded">
|
|
<StackLayout orientation="vertical">
|
|
{%raw%}<TextField text="{{ someProperty }}" />
|
|
<TextField text="{{ someProperty }}" />{%endraw%}
|
|
</StackLayout>
|
|
</Page>
|
|
```
|
|
{%snippet binding-text-property-textfield%}
|
|
## Creating a TextField
|
|
{%snippet creating-textfield%}
|
|
### Setting the text of a TextField
|
|
{%snippet setting-text-property%}
|
|
### Setting the text of a TextField
|
|
{%snippet setting-hint-property%}
|
|
### Binding text property directly to model
|
|
{%snippet binding-text-property-second%}
|
|
### Setting the hint of a TextField
|
|
{%snippet setting-hint-text%}
|
|
### Binding hint property directly to model
|
|
{%snippet binding-hint-property-textfield%}
|
|
### Setting the secure property of a TextField
|
|
{%snippet setting-secure-property%}
|
|
### Binding secure property directly to model
|
|
{%snippet binding-secure-property%}
|