You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<xref:Microsoft.Maui.Controls.Editor> defines the following properties:
12
12
13
+
::: moniker range="=net-maui-7.0"
14
+
13
15
-`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.
15
16
-`CursorPosition`, of type `int`, defines the position of the cursor within the editor.
16
17
-`FontAttributes`, of type `FontAttributes`, determines text style.
17
18
-`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`.
18
19
-`FontFamily`, of type `string`, defines the font family.
19
20
-`FontSize`, of type `double`, defines the font size.
20
21
-`HorizontalTextAlignment`, of type `TextAlignment`, defines the horizontal alignment of the text.
21
22
-`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.
24
23
-`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.
27
24
-`VerticalTextAlignment`, of type `TextAlignment`, defines the vertical alignment of the text.
28
25
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
+
29
36
These properties are backed by <xref:Microsoft.Maui.Controls.BindableProperty> objects, which means that they can be targets of data bindings, and styled.
30
37
31
38
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.
32
39
33
40
<xref:Microsoft.Maui.Controls.Editor> derives from the `InputView` class, from which it inherits the following properties:
34
41
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.
35
65
-`IsReadOnly`, of type `bool`, defines whether the user should be prevented from modifying text. The default value of this property is `false`.
36
66
-`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.
37
68
-`Keyboard`, of type `Keyboard`, specifies the virtual keyboard that's displayed when entering text.
38
69
-`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.
39
75
-`TextTransform`, of type `TextTransform`, specifies the casing of the entered text.
40
76
77
+
::: moniker-end
78
+
41
79
These properties are backed by <xref:Microsoft.Maui.Controls.BindableProperty> objects, which means that they can be targets of data bindings, and styled.
42
80
43
81
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.
<xref:Microsoft.Maui.Controls.Entry> defines the following properties:
12
12
13
+
::: moniker range="=net-maui-7.0"
14
+
13
15
-`CharacterSpacing`, of type `double`, sets the spacing between characters in the entered text.
14
16
-`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.
15
17
-`CursorPosition`, of type `int`, defines the position of the cursor within the entry.
16
18
-`FontAttributes`, of type `FontAttributes`, determines text style.
17
19
-`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`.
18
20
-`FontFamily`, of type `string`, defines the font family.
19
21
-`FontSize`, of type `double`, defines the font size.
20
-
-`Keyboard`, of type `Keyboard`, specifies the virtual keyboard that's displayed when entering text.
21
22
-`HorizontalTextAlignment`, of type `TextAlignment`, defines the horizontal alignment of the text.
22
23
-`IsPassword`, of type `bool`, specifies whether the entry should visually obscure typed text.
23
24
-`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.
26
25
-`ReturnCommand`, of type `ICommand`, defines the command to be executed when the return key is pressed.
27
26
-`ReturnCommandParameter`, of type `object`, specifies the parameter for the `ReturnCommand`.
28
27
-`ReturnType`, of type `ReturnType`, specifies the appearance of the return button.
29
28
-`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.
32
29
-`VerticalTextAlignment`, of type `TextAlignment`, defines the vertical alignment of the text.
33
30
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
+
34
45
These properties are backed by <xref:Microsoft.Maui.Controls.BindableProperty> objects, which means that they can be targets of data bindings, and styled.
35
46
36
47
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.
37
48
38
49
<xref:Microsoft.Maui.Controls.Entry> derives from the `InputView` class, from which it inherits the following properties:
39
50
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.
40
74
-`IsReadOnly`, of type `bool`, defines whether the user should be prevented from modifying text. The default value of this property is `false`.
41
75
-`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.
42
78
-`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.
43
84
-`TextTransform`, of type `TextTransform`, specifies the casing of the entered text.
44
85
86
+
::: moniker-end
87
+
45
88
These properties are backed by <xref:Microsoft.Maui.Controls.BindableProperty> objects, which means that they can be targets of data bindings, and styled.
46
89
47
90
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.
Copy file name to clipboardExpand all lines: docs/user-interface/controls/searchbar.md
+57-8Lines changed: 57 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: "SearchBar"
3
3
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."
<xref:Microsoft.Maui.Controls.SearchBar> defines the following properties:
14
14
15
+
::: moniker range="=net-maui-7.0"
16
+
15
17
-`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.
17
18
-`CursorPosition` is an `int` that determines the position at which the next character will be inserted into the string stored in the `Text` property.
18
19
-`FontAttributes` is a `FontAttributes` enum value that determines whether the <xref:Microsoft.Maui.Controls.SearchBar> font is bold, italic, or neither.
19
20
-`FontAutoScalingEnabled` is a `bool` which defines whether an app's UI reflects text scaling preferences set in the operating system.
20
21
-`FontFamily` is a `string` that determines the font family used by the <xref:Microsoft.Maui.Controls.SearchBar>.
21
22
-`FontSize` is a `double` value that represents specific font sizes across platforms.
22
23
-`HorizontalTextAlignment` is a `TextAlignment` enum value that defines the horizontal alignment of the query text.
23
24
-`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.
26
25
-`SearchCommand` is an `ICommand` that allows binding user actions, such as finger taps or clicks, to commands defined on a viewmodel.
27
26
-`SearchCommandParameter` is an `object` that specifies the parameter that should be passed to the `SearchCommand`.
28
27
-`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.
31
28
-`VerticalTextAlignment` is a `TextAlignment` enum value that defines the vertical alignment of the query text.
32
29
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
+
33
42
These properties are backed by <xref:Microsoft.Maui.Controls.BindableProperty> objects, which means that they can be targets of data bindings, and styled.
34
43
35
44
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.
36
45
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.
0 commit comments