Skip to content

Commit 4ec7916

Browse files
authored
Common properties moved to InputView (#1789)
* Properties moved to InputView. * Edits. * Edit.
1 parent b1525d0 commit 4ec7916

File tree

4 files changed

+151
-20
lines changed

4 files changed

+151
-20
lines changed

docs/user-interface/controls/editor.md

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Editor"
33
description: "The .NET MAUI Editor allows you to enter and edit multiple lines of text."
4-
ms.date: 03/03/2022
4+
ms.date: 10/13/2023
55
---
66

77
# Editor
@@ -10,34 +10,72 @@ The .NET Multi-platform App UI (.NET MAUI) <xref:Microsoft.Maui.Controls.Editor>
1010

1111
<xref:Microsoft.Maui.Controls.Editor> defines the following properties:
1212

13+
::: moniker range="=net-maui-7.0"
14+
1315
- `AutoSize`, of type `EditorAutoSizeOption`, defines whether the editor will change size to accommodate user input. By default, the editor doesn't auto size.
14-
- `CharacterSpacing`, of type `double`, sets the spacing between characters in the entered text.
1516
- `CursorPosition`, of type `int`, defines the position of the cursor within the editor.
1617
- `FontAttributes`, of type `FontAttributes`, determines text style.
1718
- `FontAutoScalingEnabled`, of type `bool`, defines whether the text will reflect scaling preferences set in the operating system. The default value of this property is `true`.
1819
- `FontFamily`, of type `string`, defines the font family.
1920
- `FontSize`, of type `double`, defines the font size.
2021
- `HorizontalTextAlignment`, of type `TextAlignment`, defines the horizontal alignment of the text.
2122
- `IsTextPredictionEnabled`, of type `bool`, controls whether text prediction and automatic text correction is enabled.
22-
- `Placeholder`, of type `string`, defines the text that's displayed when the control is empty.
23-
- `PlaceholderColor`, of type <xref:Microsoft.Maui.Graphics.Color>, defines the color of the placeholder text.
2423
- `SelectionLength`, of type `int`, represents the length of selected text within the editor.
25-
- `Text`, of type `string`, defines the text entered into the editor.
26-
- `TextColor`, of type <xref:Microsoft.Maui.Graphics.Color>, defines the color of the entered text.
2724
- `VerticalTextAlignment`, of type `TextAlignment`, defines the vertical alignment of the text.
2825

26+
::: moniker-end
27+
28+
::: moniker range=">=net-maui-8.0"
29+
30+
- `AutoSize`, of type `EditorAutoSizeOption`, defines whether the editor will change size to accommodate user input. By default, the editor doesn't auto size.
31+
- `HorizontalTextAlignment`, of type `TextAlignment`, defines the horizontal alignment of the text.
32+
- `VerticalTextAlignment`, of type `TextAlignment`, defines the vertical alignment of the text.
33+
34+
::: moniker-end
35+
2936
These properties are backed by <xref:Microsoft.Maui.Controls.BindableProperty> objects, which means that they can be targets of data bindings, and styled.
3037

3138
In addition, <xref:Microsoft.Maui.Controls.Editor> defines a `Completed` event, which is raised when the user finalizes text in the <xref:Microsoft.Maui.Controls.Editor> with the return key.
3239

3340
<xref:Microsoft.Maui.Controls.Editor> derives from the `InputView` class, from which it inherits the following properties:
3441

42+
::: moniker range="=net-maui-7.0"
43+
44+
- `CharacterSpacing`, of type `double`, sets the spacing between characters in the entered text.
45+
- `IsReadOnly`, of type `bool`, defines whether the user should be prevented from modifying text. The default value of this property is `false`.
46+
- `IsSpellCheckEnabled`, of type `bool`, controls whether spell checking is enabled.
47+
- `Keyboard`, of type `Keyboard`, specifies the virtual keyboard that's displayed when entering text.
48+
- `MaxLength`, of type `int`, defines the maximum input length.
49+
- `Placeholder`, of type `string`, defines the text that's displayed when the control is empty.
50+
- `PlaceholderColor`, of type <xref:Microsoft.Maui.Graphics.Color>, defines the color of the placeholder text.
51+
- `Text`, of type `string`, defines the text entered into the control.
52+
- `TextColor`, of type <xref:Microsoft.Maui.Graphics.Color>, defines the color of the entered text.
53+
- `TextTransform`, of type `TextTransform`, specifies the casing of the entered text.
54+
55+
::: moniker-end
56+
57+
::: moniker range=">=net-maui-8.0"
58+
59+
- `CharacterSpacing`, of type `double`, sets the spacing between characters in the entered text.
60+
- `CursorPosition`, of type `int`, defines the position of the cursor within the editor.
61+
- `FontAttributes`, of type `FontAttributes`, determines text style.
62+
- `FontAutoScalingEnabled`, of type `bool`, defines whether the text will reflect scaling preferences set in the operating system. The default value of this property is `true`.
63+
- `FontFamily`, of type `string`, defines the font family.
64+
- `FontSize`, of type `double`, defines the font size.
3565
- `IsReadOnly`, of type `bool`, defines whether the user should be prevented from modifying text. The default value of this property is `false`.
3666
- `IsSpellCheckEnabled`, of type `bool`, controls whether spell checking is enabled.
67+
- `IsTextPredictionEnabled`, of type `bool`, controls whether text prediction and automatic text correction is enabled.
3768
- `Keyboard`, of type `Keyboard`, specifies the virtual keyboard that's displayed when entering text.
3869
- `MaxLength`, of type `int`, defines the maximum input length.
70+
- `Placeholder`, of type `string`, defines the text that's displayed when the control is empty.
71+
- `PlaceholderColor`, of type <xref:Microsoft.Maui.Graphics.Color>, defines the color of the placeholder text.
72+
- `SelectionLength`, of type `int`, represents the length of selected text within the control.
73+
- `Text`, of type `string`, defines the text entered into the control.
74+
- `TextColor`, of type <xref:Microsoft.Maui.Graphics.Color>, defines the color of the entered text.
3975
- `TextTransform`, of type `TextTransform`, specifies the casing of the entered text.
4076

77+
::: moniker-end
78+
4179
These properties are backed by <xref:Microsoft.Maui.Controls.BindableProperty> objects, which means that they can be targets of data bindings, and styled.
4280

4381
In addition, `InputView` defines a `TextChanged` event, which is raised when the text in the <xref:Microsoft.Maui.Controls.Editor> changes. The `TextChangedEventArgs` object that accompanies the `TextChanged` event has `NewTextValue` and `OldTextValue` properties, which specify the new and old text, respectively.

docs/user-interface/controls/entry.md

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Entry"
33
description: "The .NET MAUI Entry allows you to enter and edit a single line of text."
4-
ms.date: 03/03/2022
4+
ms.date: 10/13/2023
55
---
66

77
# Entry
@@ -10,38 +10,81 @@ The .NET Multi-platform App UI (.NET MAUI) <xref:Microsoft.Maui.Controls.Entry>
1010

1111
<xref:Microsoft.Maui.Controls.Entry> defines the following properties:
1212

13+
::: moniker range="=net-maui-7.0"
14+
1315
- `CharacterSpacing`, of type `double`, sets the spacing between characters in the entered text.
1416
- `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.
1517
- `CursorPosition`, of type `int`, defines the position of the cursor within the entry.
1618
- `FontAttributes`, of type `FontAttributes`, determines text style.
1719
- `FontAutoScalingEnabled`, of type `bool`, defines whether the text will reflect scaling preferences set in the operating system. The default value of this property is `true`.
1820
- `FontFamily`, of type `string`, defines the font family.
1921
- `FontSize`, of type `double`, defines the font size.
20-
- `Keyboard`, of type `Keyboard`, specifies the virtual keyboard that's displayed when entering text.
2122
- `HorizontalTextAlignment`, of type `TextAlignment`, defines the horizontal alignment of the text.
2223
- `IsPassword`, of type `bool`, specifies whether the entry should visually obscure typed text.
2324
- `IsTextPredictionEnabled`, of type `bool`, controls whether text prediction and automatic text correction is enabled.
24-
- `Placeholder`, of type `string`, defines the text that's displayed when the control is empty.
25-
- `PlaceholderColor`, of type <xref:Microsoft.Maui.Graphics.Color>, defines the color of the placeholder text.
2625
- `ReturnCommand`, of type `ICommand`, defines the command to be executed when the return key is pressed.
2726
- `ReturnCommandParameter`, of type `object`, specifies the parameter for the `ReturnCommand`.
2827
- `ReturnType`, of type `ReturnType`, specifies the appearance of the return button.
2928
- `SelectionLength`, of type `int`, represents the length of selected text within the entry.
30-
- `Text`, of type `string`, defines the text entered into the entry.
31-
- `TextColor`, of type <xref:Microsoft.Maui.Graphics.Color>, defines the color of the entered text.
3229
- `VerticalTextAlignment`, of type `TextAlignment`, defines the vertical alignment of the text.
3330

31+
::: moniker-end
32+
33+
::: moniker range=">=net-maui-8.0"
34+
35+
- `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.
36+
- `HorizontalTextAlignment`, of type `TextAlignment`, defines the horizontal alignment of the text.
37+
- `IsPassword`, of type `bool`, specifies whether the entry should visually obscure typed text.
38+
- `ReturnCommand`, of type `ICommand`, defines the command to be executed when the return key is pressed.
39+
- `ReturnCommandParameter`, of type `object`, specifies the parameter for the `ReturnCommand`.
40+
- `ReturnType`, of type `ReturnType`, specifies the appearance of the return button.
41+
- `VerticalTextAlignment`, of type `TextAlignment`, defines the vertical alignment of the text.
42+
43+
::: moniker-end
44+
3445
These properties are backed by <xref:Microsoft.Maui.Controls.BindableProperty> objects, which means that they can be targets of data bindings, and styled.
3546

3647
In addition, <xref:Microsoft.Maui.Controls.Entry> defines a `Completed` event, which is raised when the user finalizes text in the <xref:Microsoft.Maui.Controls.Entry> with the return key.
3748

3849
<xref:Microsoft.Maui.Controls.Entry> derives from the `InputView` class, from which it inherits the following properties:
3950

51+
::: moniker range="=net-maui-7.0"
52+
53+
- `CharacterSpacing`, of type `double`, sets the spacing between characters in the entered text.
54+
- `IsReadOnly`, of type `bool`, defines whether the user should be prevented from modifying text. The default value of this property is `false`.
55+
- `IsSpellCheckEnabled`, of type `bool`, controls whether spell checking is enabled.
56+
- `Keyboard`, of type `Keyboard`, specifies the virtual keyboard that's displayed when entering text.
57+
- `MaxLength`, of type `int`, defines the maximum input length.
58+
- `Placeholder`, of type `string`, defines the text that's displayed when the control is empty.
59+
- `PlaceholderColor`, of type <xref:Microsoft.Maui.Graphics.Color>, defines the color of the placeholder text.
60+
- `Text`, of type `string`, defines the text entered into the control.
61+
- `TextColor`, of type <xref:Microsoft.Maui.Graphics.Color>, defines the color of the entered text.
62+
- `TextTransform`, of type `TextTransform`, specifies the casing of the entered text.
63+
64+
::: moniker-end
65+
66+
::: moniker range=">=net-maui-8.0"
67+
68+
- `CharacterSpacing`, of type `double`, sets the spacing between characters in the entered text.
69+
- `CursorPosition`, of type `int`, defines the position of the cursor within the editor.
70+
- `FontAttributes`, of type `FontAttributes`, determines text style.
71+
- `FontAutoScalingEnabled`, of type `bool`, defines whether the text will reflect scaling preferences set in the operating system. The default value of this property is `true`.
72+
- `FontFamily`, of type `string`, defines the font family.
73+
- `FontSize`, of type `double`, defines the font size.
4074
- `IsReadOnly`, of type `bool`, defines whether the user should be prevented from modifying text. The default value of this property is `false`.
4175
- `IsSpellCheckEnabled`, of type `bool`, controls whether spell checking is enabled.
76+
- `IsTextPredictionEnabled`, of type `bool`, controls whether text prediction and automatic text correction is enabled.
77+
- `Keyboard`, of type `Keyboard`, specifies the virtual keyboard that's displayed when entering text.
4278
- `MaxLength`, of type `int`, defines the maximum input length.
79+
- `Placeholder`, of type `string`, defines the text that's displayed when the control is empty.
80+
- `PlaceholderColor`, of type <xref:Microsoft.Maui.Graphics.Color>, defines the color of the placeholder text.
81+
- `SelectionLength`, of type `int`, represents the length of selected text within the control.
82+
- `Text`, of type `string`, defines the text entered into the control.
83+
- `TextColor`, of type <xref:Microsoft.Maui.Graphics.Color>, defines the color of the entered text.
4384
- `TextTransform`, of type `TextTransform`, specifies the casing of the entered text.
4485

86+
::: moniker-end
87+
4588
These properties are backed by <xref:Microsoft.Maui.Controls.BindableProperty> objects, which means that they can be targets of data bindings, and styled.
4689

4790
In addition, `InputView` defines a `TextChanged` event, which is raised when the text in the <xref:Microsoft.Maui.Controls.Entry> changes. The `TextChangedEventArgs` object that accompanies the `TextChanged` event has `NewTextValue` and `OldTextValue` properties, which specify the new and old text, respectively.

docs/user-interface/controls/searchbar.md

Lines changed: 57 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "SearchBar"
33
description: "The .NET MAUI SearchBar is a user input control that is used for initiating a search. The SearchBar control supports placeholder text, query input, execution, and cancellation."
4-
ms.date: 02/15/2022
4+
ms.date: 10/13/2023
55
---
66

77
# SearchBar
@@ -12,30 +12,79 @@ The .NET Multi-platform App UI (.NET MAUI) <xref:Microsoft.Maui.Controls.SearchB
1212

1313
<xref:Microsoft.Maui.Controls.SearchBar> defines the following properties:
1414

15+
::: moniker range="=net-maui-7.0"
16+
1517
- `CancelButtonColor` is a <xref:Microsoft.Maui.Graphics.Color> that defines the color of the cancel button.
16-
- `CharacterSpacing`, is a `double` that's the spacing between characters of the <xref:Microsoft.Maui.Controls.SearchBar> text.
1718
- `CursorPosition` is an `int` that determines the position at which the next character will be inserted into the string stored in the `Text` property.
1819
- `FontAttributes` is a `FontAttributes` enum value that determines whether the <xref:Microsoft.Maui.Controls.SearchBar> font is bold, italic, or neither.
1920
- `FontAutoScalingEnabled` is a `bool` which defines whether an app's UI reflects text scaling preferences set in the operating system.
2021
- `FontFamily` is a `string` that determines the font family used by the <xref:Microsoft.Maui.Controls.SearchBar>.
2122
- `FontSize` is a `double` value that represents specific font sizes across platforms.
2223
- `HorizontalTextAlignment` is a `TextAlignment` enum value that defines the horizontal alignment of the query text.
2324
- `IsTextPredictionEnabled` is a `bool` that determines whether text prediction and automatic text correction is enabled.
24-
- `Placeholder` is a `string` that defines the placeholder text, such as "Search...".
25-
- `PlaceholderColor` is a <xref:Microsoft.Maui.Graphics.Color> that defines the color of the placeholder text.
2625
- `SearchCommand` is an `ICommand` that allows binding user actions, such as finger taps or clicks, to commands defined on a viewmodel.
2726
- `SearchCommandParameter` is an `object` that specifies the parameter that should be passed to the `SearchCommand`.
2827
- `SelectionLength` is an `int` that can be used to return or set the length of text selection within the <xref:Microsoft.Maui.Controls.SearchBar>.
29-
- `Text` is a `string` containing the query text in the <xref:Microsoft.Maui.Controls.SearchBar>.
30-
- `TextColor` is a <xref:Microsoft.Maui.Graphics.Color> that defines the query text color.
3128
- `VerticalTextAlignment` is a `TextAlignment` enum value that defines the vertical alignment of the query text.
3229

30+
::: moniker-end
31+
32+
::: moniker range=">=net-maui-8.0"
33+
34+
- `CancelButtonColor` is a <xref:Microsoft.Maui.Graphics.Color> that defines the color of the cancel button.
35+
- `HorizontalTextAlignment` is a `TextAlignment` enum value that defines the horizontal alignment of the query text.
36+
- `SearchCommand` is an `ICommand` that allows binding user actions, such as finger taps or clicks, to commands defined on a viewmodel.
37+
- `SearchCommandParameter` is an `object` that specifies the parameter that should be passed to the `SearchCommand`.
38+
- `VerticalTextAlignment` is a `TextAlignment` enum value that defines the vertical alignment of the query text.
39+
40+
::: moniker-end
41+
3342
These properties are backed by <xref:Microsoft.Maui.Controls.BindableProperty> objects, which means that they can be targets of data bindings, and styled.
3443

3544
In addition, <xref:Microsoft.Maui.Controls.SearchBar> defines a `SearchButtonPressed` event, which is raised when the search button is clicked, or the enter key is pressed.
3645

37-
> [!NOTE]
38-
><xref:Microsoft.Maui.Controls.SearchBar> derives from the `InputView` class, from which it inherits additional properties and events.
46+
<xref:Microsoft.Maui.Controls.SearchBar> derives from the `InputView` class, from which it inherits the following properties:
47+
48+
::: moniker range="=net-maui-7.0"
49+
50+
- `CharacterSpacing`, of type `double`, sets the spacing between characters in the entered text.
51+
- `IsReadOnly`, of type `bool`, defines whether the user should be prevented from modifying text. The default value of this property is `false`.
52+
- `IsSpellCheckEnabled`, of type `bool`, controls whether spell checking is enabled.
53+
- `Keyboard`, of type `Keyboard`, specifies the virtual keyboard that's displayed when entering text.
54+
- `MaxLength`, of type `int`, defines the maximum input length.
55+
- `Placeholder`, of type `string`, defines the text that's displayed when the control is empty.
56+
- `PlaceholderColor`, of type <xref:Microsoft.Maui.Graphics.Color>, defines the color of the placeholder text.
57+
- `Text`, of type `string`, defines the text entered into the control.
58+
- `TextColor`, of type <xref:Microsoft.Maui.Graphics.Color>, defines the color of the entered text.
59+
- `TextTransform`, of type `TextTransform`, specifies the casing of the entered text.
60+
61+
::: moniker-end
62+
63+
::: moniker range=">=net-maui-8.0"
64+
65+
- `CharacterSpacing`, of type `double`, sets the spacing between characters in the entered text.
66+
- `CursorPosition`, of type `int`, defines the position of the cursor within the editor.
67+
- `FontAttributes`, of type `FontAttributes`, determines text style.
68+
- `FontAutoScalingEnabled`, of type `bool`, defines whether the text will reflect scaling preferences set in the operating system. The default value of this property is `true`.
69+
- `FontFamily`, of type `string`, defines the font family.
70+
- `FontSize`, of type `double`, defines the font size.
71+
- `IsReadOnly`, of type `bool`, defines whether the user should be prevented from modifying text. The default value of this property is `false`.
72+
- `IsSpellCheckEnabled`, of type `bool`, controls whether spell checking is enabled.
73+
- `IsTextPredictionEnabled`, of type `bool`, controls whether text prediction and automatic text correction is enabled.
74+
- `Keyboard`, of type `Keyboard`, specifies the virtual keyboard that's displayed when entering text.
75+
- `MaxLength`, of type `int`, defines the maximum input length.
76+
- `Placeholder`, of type `string`, defines the text that's displayed when the control is empty.
77+
- `PlaceholderColor`, of type <xref:Microsoft.Maui.Graphics.Color>, defines the color of the placeholder text.
78+
- `SelectionLength`, of type `int`, represents the length of selected text within the control.
79+
- `Text`, of type `string`, defines the text entered into the control.
80+
- `TextColor`, of type <xref:Microsoft.Maui.Graphics.Color>, defines the color of the entered text.
81+
- `TextTransform`, of type `TextTransform`, specifies the casing of the entered text.
82+
83+
::: moniker-end
84+
85+
These properties are backed by <xref:Microsoft.Maui.Controls.BindableProperty> objects, which means that they can be targets of data bindings, and styled.
86+
87+
In addition, `InputView` defines a `TextChanged` event, which is raised when the text in the <xref:Microsoft.Maui.Controls.Entry> changes. The `TextChangedEventArgs` object that accompanies the `TextChanged` event has `NewTextValue` and `OldTextValue` properties, which specify the new and old text, respectively.
3988

4089
## Create a SearchBar
4190

0 commit comments

Comments
 (0)