New-ish to Android and Xamarin, working in VS 2019, Xamarin Forms v4.8 ...
In my project, I have implemented a custom renderer for an Editor that provides a read-only Editor in which the user can select and copy text. Works great, with customized context menu (removing Cut and Paste options). Thank you Anna Domashych! (https://medium.com/@anna.domashych/selectable-read-only-multiline-text-field-in-xamarin-forms-69d09276d580)
I also want to provide a search function, where user enters text to be found (in an Entry or SearchBar), and the app finds and selects the found text, and then scrolls the found text into view, if necessary.
But I see no way to have the app select text in the Editor. An Entry has CursorPosition and SelectionLength properties, which I presume can be used to programmatically select text, but an Editor does not seem to have these properties. Call me crazy, but that fact seems particularly odd to me!
I was hoping I could extend my custom renderer, but custom renderers seem to provide a mechanism to set behavior-type properties that are not exposed in the cross platform Xamarin view (such as, SetTextIsSelectable). That is, it seems that a custom renderer cannot provide a means to set properties on the underlying Android control, from code in the shared project (dynamically?). In particular I am interested in the setSelection(int start, int stop) method of the Android EditText view.
Is there any way to do this?
Thanks