How to create a multi-line text box in xamarin.forms

How to create a multi-line text block in xamarin.forms?

With some research, I found that this can be done with the <Editor> on the xaml page with a custom font size and style, but creating text aligned to the center. But I want to start the cursor and the text in the upper left.

Thanks.

+5
source share
3 answers

The editor is used to collect text that is expected to take more than one line. Example:

 <?xml version="1.0" encoding="UTF-8"?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="TextSample.EditorPage" Title="Editor"> <ContentPage.Content> <StackLayout> <Editor Text="Editor is used for collecting text that is expected to take more than one line." BackgroundColor="#2c3e50" HeightRequest="100" /> </StackLayout> </ContentPage.Content> </ContentPage> 
+2
source

Editor , as you mentioned, encoded this way (sample from the page) does not create centered text

  <StackLayout Padding="5,10"> <Editor> <Editor.BackgroundColor> <OnPlatform x:TypeArguments="x:Color" iOS="#a4eaff" Android="#2c3e50" WinPhone="#2c3e50" /> </Editor.BackgroundColor> </Editor> </StackLayout> 
0
source

A multiline text field allows you to display multiple lines of text in an element. If

TextBoxBase.WordWrap

Property

set to true , text entered in a multi-line text box is wrapped to the next line in the control. If

TextBoxBase.WordWrap

the property is false , the text entered in the multiline text block will be displayed on the same line until a newline is entered

-5
source

Source: https://habr.com/ru/post/1206999/


All Articles