1using System.Windows.Input;
2using Microsoft.Maui.Controls;
3using Microsoft.Maui.Controls.Shapes;
5using Path =
Microsoft.Maui.Controls.Shapes.Path;
14 #region Bindable Properties
182 public static new readonly BindableProperty BackgroundColorProperty = BindableProperty.Create(
183 nameof(BackgroundColor),
188 public new Color BackgroundColor
190 get => (Color)this.GetValue(BackgroundColorProperty);
191 set => this.SetValue(BackgroundColorProperty, value);
198 private readonly Entry innerEntry;
217 public new event EventHandler<FocusEventArgs>?
Focused;
222 public new event EventHandler<FocusEventArgs>?
Unfocused;
234 this.innerEntry =
new Entry
236 VerticalOptions = LayoutOptions.Center,
237 HorizontalOptions = LayoutOptions.Fill,
238 BackgroundColor = Colors.Transparent
242 this.innerEntry.SetBinding(Entry.TextProperty,
new Binding(nameof(this.
EntryData), source:
this));
243 this.innerEntry.SetBinding(Entry.PlaceholderProperty,
new Binding(nameof(this.
Placeholder), source:
this));
244 this.innerEntry.SetBinding(Entry.IsPasswordProperty,
new Binding(nameof(this.
IsPassword), source:
this));
245 this.innerEntry.SetBinding(Entry.KeyboardProperty,
new Binding(nameof(this.
Keyboard), source:
this));
246 this.innerEntry.SetBinding(Entry.StyleProperty,
new Binding(nameof(this.
EntryStyle), source:
this));
247 this.innerEntry.SetBinding(Entry.TextColorProperty,
new Binding(nameof(this.
TextColor), source:
this));
248 this.innerEntry.SetBinding(InputView.IsSpellCheckEnabledProperty,
new Binding(nameof(this.
IsSpellCheckEnabled), source:
this));
249 this.innerEntry.SetBinding(InputView.IsTextPredictionEnabledProperty,
new Binding(nameof(this.
IsTextPredictionEnabled), source:
this));
250 this.innerEntry.SetBinding(Entry.IsReadOnlyProperty,
new Binding(nameof(this.
IsReadOnly), source:
this));
253 this.innerEntry.Completed += this.OnEntryCompleted;
254 this.innerEntry.TextChanged += this.OnEntryTextChanged;
255 this.innerEntry.Focused += this.OnEntryFocused;
256 this.innerEntry.Unfocused += this.OnEntryUnfocused;
259 this.CenterView = this.innerEntry;
264 #region Property Overrides
272 get => this.innerEntry.StyleId;
273 set => this.innerEntry.StyleId = value;
276 public new string AutomationId
278 get => this.innerEntry.AutomationId;
279 set => this.innerEntry.AutomationId = value;
291 return this.innerEntry.Focus();
299 this.innerEntry.Unfocus();
304 #region Property Changed Callbacks
308 #region Event Handlers
310 private void OnEntryTextChanged(
object? sender, TextChangedEventArgs e)
319 private void OnEntryCompleted(
object? sender, EventArgs e)
328 private void OnEntryFocused(
object? sender, FocusEventArgs e)
338 private void OnEntryUnfocused(
object? sender, FocusEventArgs e)
A customizable entry control that allows setting views on the left and right sides of the entry.
string EntryData
Gets or sets the text displayed in the entry.
Keyboard Keyboard
Gets or sets the keyboard type used by the entry.
bool IsReadOnly
Gets or sets a value indicating whether text prediction is enabled.
new? EventHandler< FocusEventArgs > Unfocused
Occurs when the entry loses focus.
string Placeholder
Gets or sets the placeholder text displayed when the entry is empty.
bool IsSpellCheckEnabled
Gets or sets a value indicating whether spell check is enabled.
static readonly BindableProperty EntryDataProperty
Bindable property for the text displayed in the entry.
static readonly BindableProperty IsPasswordProperty
Bindable property indicating whether the entry is used for password input.
new void Unfocus()
Unfocuses the Entry.
static readonly BindableProperty IsSpellCheckEnabledProperty
Bindable property indicating whether spell check is enabled.
Style EntryStyle
Gets or sets the style applied to the entry.
static readonly BindableProperty EntryStyleProperty
Bindable property for the style applied to the entry.
CompositeEntry()
Initializes a new instance of the CompositeEntry class.
Color TextColor
Gets or sets the text color of the entry.
static readonly BindableProperty PlaceholderProperty
Bindable property for the placeholder text displayed when the entry is empty.
EventHandler< TextChangedEventArgs >? TextChanged
Occurs when the text of the entry changes.
new? EventHandler< FocusEventArgs > Focused
Occurs when the entry gains focus.
new bool Focus()
Focuses the Entry.
new string StyleId
Gets or sets a user-defined value to uniquely identify the element. This is forwarded to the inner En...
EventHandler? Completed
Occurs when the user finalizes the text in an entry with the return key.
bool IsPassword
Gets or sets a value indicating whether the entry is used for password input.
bool IsTextPredictionEnabled
Gets or sets a value indicating whether text prediction is enabled.
static readonly BindableProperty IsReadOnlyProperty
Bindable property indicating whether Read Only is enabled.
static readonly BindableProperty KeyboardProperty
Bindable property for the keyboard type used by the entry.
static readonly BindableProperty TextColorProperty
Bindable property for the text color of the entry.
static readonly BindableProperty IsTextPredictionEnabledProperty
Bindable property indicating whether text prediction is enabled.