mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
36 lines
1.1 KiB
Markdown
36 lines
1.1 KiB
Markdown
---
|
|
nav-title: "TextField How-To"
|
|
title: "How-To"
|
|
description: "Examples for using TextField"
|
|
---
|
|
# TextField
|
|
Using a TextField requires the text-field module.
|
|
<snippet id='require-textfield'/>
|
|
<snippet id='require-observable'/>
|
|
### Binding two TextFields text property to observable view-model property.
|
|
```XML
|
|
<Page loaded="pageLoaded">
|
|
<StackLayout orientation="vertical">
|
|
{%raw%}<TextView text="{{ someProperty }}" />
|
|
<TextView text="{{ someProperty }}" />{%endraw%}
|
|
</StackLayout>
|
|
</Page>
|
|
```
|
|
<snippet id='binding-text-property'/>
|
|
## Creating a TextField
|
|
<snippet id='creating-textfield'/>
|
|
### Setting the text of a TextField
|
|
<snippet id='setting-text-property'/>
|
|
### Setting the text of a TextField
|
|
<snippet id='setting-hint-property'/>
|
|
### Binding text property directly to model
|
|
<snippet id='binding-text-property-second'/>
|
|
### Setting the hint of a TextField
|
|
<snippet id='setting-hint-text'/>
|
|
### Binding hint property directly to model
|
|
<snippet id='binding-hint-property'/>
|
|
### Setting the secure property of a TextField
|
|
<snippet id='setting-secure-property'/>
|
|
### Binding secure property directly to model
|
|
<snippet id='binding-secure-property'/>
|