I found a solution by hooking into Focused event. Maybe you could consider implementing a
SelectAllTextOnFocus property in the next release, which would make it simpler :-)
private void OnFocused(object? sender, FocusEventArgs e)
{
if (sender is SfAutocomplete autocomplete)
{
// The SfAutocomplete control internally contains a SfInputView which inherits from Entry.
// We need to find it to select the text.
var entry = autocomplete.Children.OfType<Entry>().FirstOrDefault();
if (entry != null)
{
Dispatcher.Dispatch(() =>
{
// Select all text if any
entry.CursorPosition = 0;
entry.SelectionLength = entry.Text?.Length ?? 0;
});
}
}
}
Usage:
myAutocomplete.Focused += OnFocused;
Regards
Michael