Skip to content

Commit

Permalink
TextAlignment.Justify (#2540)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbritch authored Oct 4, 2024
1 parent 5ae7517 commit da7a34c
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions docs/user-interface/controls/editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ The .NET Multi-platform App UI (.NET MAUI) <xref:Microsoft.Maui.Controls.Editor>
<xref:Microsoft.Maui.Controls.Editor> defines the following properties:

- `AutoSize`, of type `EditorAutoSizeOption`, defines whether the editor will change size to accommodate user input. By default, the editor doesn't auto size.
- `HorizontalTextAlignment`, of type `TextAlignment`, defines the horizontal alignment of the text.
- `VerticalTextAlignment`, of type `TextAlignment`, defines the vertical alignment of the text.
- `HorizontalTextAlignment`, of type <xref:Microsoft.Maui.TextAlignment>, defines the horizontal alignment of the text.
- `VerticalTextAlignment`, of type <xref:Microsoft.Maui.TextAlignment>, defines the vertical alignment of the text.

These properties are backed by <xref:Microsoft.Maui.Controls.BindableProperty> objects, which means that they can be targets of data bindings, and styled.

Expand Down
4 changes: 2 additions & 2 deletions docs/user-interface/controls/entry.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ The .NET Multi-platform App UI (.NET MAUI) <xref:Microsoft.Maui.Controls.Entry>
<xref:Microsoft.Maui.Controls.Entry> defines the following properties:

- `ClearButtonVisibility`, of type `ClearButtonVisibility`, controls whether a clear button is displayed, which enables the user to clear the text. The default value of this property ensures that a clear button isn't displayed.
- `HorizontalTextAlignment`, of type `TextAlignment`, defines the horizontal alignment of the text.
- `HorizontalTextAlignment`, of type <xref:Microsoft.Maui.TextAlignment>, defines the horizontal alignment of the text.
- `IsPassword`, of type `bool`, specifies whether the entry should visually obscure typed text.
- `ReturnCommand`, of type <xref:System.Windows.Input.ICommand>, defines the command to be executed when the return key is pressed.
- `ReturnCommandParameter`, of type `object`, specifies the parameter for the `ReturnCommand`.
- `ReturnType`, of type `ReturnType`, specifies the appearance of the return button.
- `VerticalTextAlignment`, of type `TextAlignment`, defines the vertical alignment of the text.
- `VerticalTextAlignment`, of type <xref:Microsoft.Maui.TextAlignment>, defines the vertical alignment of the text.

These properties are backed by <xref:Microsoft.Maui.Controls.BindableProperty> objects, which means that they can be targets of data bindings, and styled.

Expand Down
4 changes: 2 additions & 2 deletions docs/user-interface/controls/label.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The .NET Multi-platform App UI (.NET MAUI) <xref:Microsoft.Maui.Controls.Label>
- `FontFamily`, of type `string`, defines the font family.
- `FontSize`, of type `double`, defines the font size.
- `FormattedText`, of type `FormattedString`, specifies the presentation of text with multiple presentation options such as fonts and colors.
- `HorizontalTextAlignment`, of type `TextAlignment`, defines the horizontal alignment of the displayed text.
- `HorizontalTextAlignment`, of type <xref:Microsoft.Maui.TextAlignment>, defines the horizontal alignment of the displayed text.
- `LineBreakMode`, of type `LineBreakMode`, determines how text should be handled when it can't fit on one line.
- `LineHeight`, of type `double`, specifies the multiplier to apply to the default line height when displaying text.
- `MaxLines`, of type `int`, indicates the maximum number of lines allowed in the <xref:Microsoft.Maui.Controls.Label>.
Expand All @@ -28,7 +28,7 @@ The .NET Multi-platform App UI (.NET MAUI) <xref:Microsoft.Maui.Controls.Label>
- `TextDecorations`, of type `TextDecorations`, specifies the text decorations (underline and strikethrough) that can be applied.
- `TextTransform`, of type `TextTransform`, specifies the casing of the displayed text.
- `TextType`, of type `TextType`, determines whether the <xref:Microsoft.Maui.Controls.Label> should display plain text or HTML text.
- `VerticalTextAlignment`, of type `TextAlignment`, defines the vertical alignment of the displayed text.
- `VerticalTextAlignment`, of type <xref:Microsoft.Maui.TextAlignment>, defines the vertical alignment of the displayed text.

These properties are backed by <xref:Microsoft.Maui.Controls.BindableProperty> objects, which means that they can be targets of data bindings, and styled.

Expand Down
4 changes: 2 additions & 2 deletions docs/user-interface/controls/picker.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The .NET Multi-platform App UI (.NET MAUI) <xref:Microsoft.Maui.Controls.Picker>
- `FontAutoScalingEnabled`, of type `bool`, which determines whether the text respects scaling preferences set in the operating system. The default value of this property is `true`.
- `FontFamily` of type `string`, which defaults to `null`.
- `FontSize` of type `double`, which defaults to -1.0.
- `HorizontalTextAlignment`, of type `TextAlignment`, is the horizontal alignment of the text displayed by the <xref:Microsoft.Maui.Controls.Picker>.
- `HorizontalTextAlignment`, of type <xref:Microsoft.Maui.TextAlignment>, is the horizontal alignment of the text displayed by the <xref:Microsoft.Maui.Controls.Picker>.
- `ItemsSource` of type `IList`, the source list of items to display, which defaults to `null`.
- `SelectedIndex` of type `int`, the index of the selected item, which defaults to -1.
- `SelectedItem` of type `object`, the selected item, which defaults to `null`.
Expand All @@ -24,7 +24,7 @@ The .NET Multi-platform App UI (.NET MAUI) <xref:Microsoft.Maui.Controls.Picker>
- `TextTransform`, of type `TextTransform`, which defines whether to transform the casing of text.
- `Title` of type `string`, which defaults to `null`.
- `TitleColor` of type <xref:Microsoft.Maui.Graphics.Color>, the color used to display the `Title` text.
- `VerticalTextAlignment`, of type `TextAlignment`, is the vertical alignment of the text displayed by the <xref:Microsoft.Maui.Controls.Picker>.
- `VerticalTextAlignment`, of type <xref:Microsoft.Maui.TextAlignment>, is the vertical alignment of the text displayed by the <xref:Microsoft.Maui.Controls.Picker>.

All of the properties, with the exception of `ItemDisplayBinding`, are backed by <xref:Microsoft.Maui.Controls.BindableProperty> objects, which means that they can be styled, and the properties can be targets of data bindings. The `SelectedIndex` and `SelectedItem` properties have a default binding mode of `BindingMode.TwoWay`, which means that they can be targets of data bindings in an application that uses the Model-View-ViewModel (MVVM) pattern. For information about setting font properties, see [Fonts](~/user-interface/fonts.md).

Expand Down
4 changes: 2 additions & 2 deletions docs/user-interface/controls/searchbar.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ The .NET Multi-platform App UI (.NET MAUI) <xref:Microsoft.Maui.Controls.SearchB
<xref:Microsoft.Maui.Controls.SearchBar> defines the following properties:

- `CancelButtonColor` is a <xref:Microsoft.Maui.Graphics.Color> that defines the color of the cancel button.
- `HorizontalTextAlignment` is a `TextAlignment` enum value that defines the horizontal alignment of the query text.
- `HorizontalTextAlignment` is a <xref:Microsoft.Maui.TextAlignment> enum value that defines the horizontal alignment of the query text.
- `SearchCommand` is an <xref:System.Windows.Input.ICommand> that allows binding user actions, such as finger taps or clicks, to commands defined on a viewmodel.
- `SearchCommandParameter` is an `object` that specifies the parameter that should be passed to the `SearchCommand`.
- `VerticalTextAlignment` is a `TextAlignment` enum value that defines the vertical alignment of the query text.
- `VerticalTextAlignment` is a <xref:Microsoft.Maui.TextAlignment> enum value that defines the vertical alignment of the query text.

These properties are backed by <xref:Microsoft.Maui.Controls.BindableProperty> objects, which means that they can be targets of data bindings, and styled.

Expand Down
4 changes: 2 additions & 2 deletions docs/user-interface/controls/tableview.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,13 @@ The following screenshot shows the resulting cell appearance:

An <xref:Microsoft.Maui.Controls.EntryCell> displays a label and text data that's editable. <xref:Microsoft.Maui.Controls.EntryCell> defines the following properties:

- `HorizontalTextAlignment`, of type `TextAlignment`, represents the horizontal alignment of the text.
- `HorizontalTextAlignment`, of type <xref:Microsoft.Maui.TextAlignment>, represents the horizontal alignment of the text.
- `Keyboard`, of type `Keyboard`, determines the keyboard to display when entering text.
- <xref:Microsoft.Maui.Controls.Label>, of type `string`, represents the text to display to the left of the editable text.
- `LabelColor`, of type <xref:Microsoft.Maui.Graphics.Color>, defines the color of the label text.
- `Placeholder`, of type `string`, represents the text that's displayed when the `Text` property is empty.
- `Text`, of type `string`, defines the text that's editable.
- `VerticalTextAlignment`, of type `TextAlignment`, represents the vertical alignment of the text.
- `VerticalTextAlignment`, of type <xref:Microsoft.Maui.TextAlignment>, represents the vertical alignment of the text.

These properties are backed by <xref:Microsoft.Maui.Controls.BindableProperty> objects, which means that they can be targets of data bindings, and styled.

Expand Down
14 changes: 7 additions & 7 deletions docs/whats-new/dotnet-9.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,21 +166,21 @@ builder.ConfigureMauiHandlers(handlers =>
#endif
```

### Label text alignment
### Soft keyboard input support

You can now horizontally align text in <xref:Microsoft.Maui.Controls.Label> objects with `HorizontalTextAlignment.Justify`:
.NET MAUI 9 adds new soft keyboard input support for `Password`, `Date`, and `Time`. These can be enabled on <xref:Microsoft.Maui.Controls.Editor> and <xref:Microsoft.Maui.Controls.Entry> controls:

```xaml
<Label Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. In facilisis nulla eu felis fringilla vulputate."
HorizontalTextAlignment="Justify"/>
<Entry Keyboard="Date" />
```

### Soft keyboard input support
### Text alignment

.NET MAUI 9 adds new soft keyboard input support for `Password`, `Date`, and `Time`. These can be enabled on <xref:Microsoft.Maui.Controls.Editor> and <xref:Microsoft.Maui.Controls.Entry> controls:
The <xref:Microsoft.Maui.TextAlignment> enumeration adds a `Justify` member that can be used to align text in text controls. For example, you can horizontally align text in a <xref:Microsoft.Maui.Controls.Label> with `HorizontalTextAlignment.Justify`:

```xaml
<Entry Keyboard="Date" />
<Label Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. In facilisis nulla eu felis fringilla vulputate."
HorizontalTextAlignment="Justify"/>
```

### TimePicker
Expand Down
2 changes: 1 addition & 1 deletion docs/xaml/fundamentals/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ The following example shows a <xref:Microsoft.Maui.Controls.ContentPage> contain

From the example above the relationship between classes, properties, and XML should be evident. A .NET MAUI class (such as <xref:Microsoft.Maui.Controls.ContentPage> or <xref:Microsoft.Maui.Controls.Label>) appears in the XAML file as an XML element. Properties of that class—including `Title` on <xref:Microsoft.Maui.Controls.ContentPage> and seven properties of <xref:Microsoft.Maui.Controls.Label> usually appear as XML attributes.

Many shortcuts exist to set the values of these properties. Some properties are basic data types. For example, the `Title` and `Text` properties are of type `string`, and `Rotation` is of type `double`. The `HorizontalTextAlignment` property is of type `TextAlignment`, which is an enumeration. For a property of any enumeration type, all you need to supply is a member name.
Many shortcuts exist to set the values of these properties. Some properties are basic data types. For example, the `Title` and `Text` properties are of type `string`, and `Rotation` is of type `double`. The `HorizontalTextAlignment` property is of type <xref:Microsoft.Maui.TextAlignment>, which is an enumeration. For a property of any enumeration type, all you need to supply is a member name.

For properties of more complex types, however, converters are used for parsing the XAML. These are classes in .NET MAUI that derive from `TypeConverter`. For the example above, several .NET MAUI converters are automatically applied to convert string values to their correct type:

Expand Down

0 comments on commit da7a34c

Please sign in to comment.