Extensões TextAlignment

As TextAlignment extensões fornecem uma série de métodos de extensão que dão suporte à configuração do alinhamento de texto dos controles que implementam ITextAlignment.

TextStart

O método TextStart define a propriedade ITextAlignment.HorizontalTextAlignment como TextAlignment.Start.

Este é um exemplo que define Label.HorizontalTextAlignment como TextAlignment.Start usando TextStart:

new Label().TextStart()

TextCenterHorizontal

O método TextCenterHorizontal define a propriedade ITextAlignment.HorizontalTextAlignment como TextAlignment.Center.

Este é um exemplo que define Label.HorizontalTextAlignment como TextAlignment.Center usando TextCenterHorizontal:

new Label().TextCenterHorizontal()

TextEnd

O método TextEnd define a propriedade ITextAlignment.HorizontalTextAlignment como TextAlignment.End.

Este é um exemplo que define Label.HorizontalTextAlignment como TextAlignment.End usando TextEnd:

new Label().TextEnd()

TextTop

O método TextTop define a propriedade ITextAlignment.VerticalTextAlignment como TextAlignment.Start.

Este é um exemplo que define Label.VerticalTextAlignment como TextAlignment.Start usando TextTop:

new Label().TextTop()

TextCenterVertical

O método TextCenterVertical define a propriedade ITextAlignment.VerticalTextAlignment como TextAlignment.Center.

Este é um exemplo que define Label.VerticalTextAlignment como TextAlignment.Center usando TextCenterVertical:

new Label().TextCenterVertical()

TextBottom

O método TextBottom define a propriedade ITextAlignment.VerticalTextAlignment como TextAlignment.End.

Este é um exemplo que define Label.VerticalTextAlignment como TextAlignment.End usando TextBottom:

new Label().TextBottom()

TextCenter

O método TextCenter define a propriedade ITextAlignment.HorizontalTextAlignment e a propriedade ITextAlignment.VerticalTextAlignment como TextAlignment.Center.

Este é um exemplo que define Label.VerticalTextAlignment e Label.HorizontalTextAlignment como TextAlignment.Center usando TextCenter:

new Label().TextCenter()

LeftToRight

O namespace LeftToRight contém dois métodos de extensão, TextLeft e TextRight, que são alinhados ao script da esquerda para a direita.

Para usar as extensões LeftToRight, primeiro, precisamos adicionar a seguinte diretiva using:

using CommunityToolkit.Maui.Markup.LeftToRight;

TextLeft

O método TextLeft define a propriedade ITextAlignment.HorizontalTextAlignment como TextAlignment.Start, alinhando-a ao script da esquerda para a direita.

Este é um exemplo que define Label.HorizontalTextAlignment como TextAlignment.Start usando TextLeft:

using CommunityToolkit.Maui.Markup.LeftToRight;

// ...

new Label().TextLeft()

TextRight

O método TextRight define a propriedade ITextAlignment.HorizontalTextAlignment como TextAlignment.End, alinhando-a ao script da esquerda para a direita.

Este é um exemplo que define Label.HorizontalTextAlignment como TextAlignment.End usando TextRight:

using CommunityToolkit.Maui.Markup.LeftToRight;

// ...

new Label().TextRight()

RightToLeft

O namespace RightToLeft contém dois métodos de extensão, TextLeft e TextRight, que são alinhados ao script da direita para a esquerda.

Para usar as extensões LeftToRight, primeiro, precisamos adicionar a seguinte diretiva using:

using CommunityToolkit.Maui.Markup.RightToLeft;

TextLeft

O método TextLeft define a propriedade ITextAlignment.HorizontalTextAlignment como TextAlignment.End, alinhando-a ao script da direita para a esquerda.

Este é um exemplo que define Label.HorizontalTextAlignment como TextAlignment.End usando TextLeft:

using CommunityToolkit.Maui.Markup.RightToLeft;

// ...

new Label().TextLeft()

TextRight

O método TextRight define a propriedade ITextAlignment.HorizontalTextAlignment como TextAlignment.Start, alinhando-a ao script da direita para a esquerda.

Este é um exemplo que define Label.HorizontalTextAlignment como TextAlignment.Start usando TextRight:

using CommunityToolkit.Maui.Markup.RightToLeft;

// ...

new Label().TextRight()