Share via

Entry Cursor not appearing when set in button's clicked event handler Xamarin forms

Simcha Cazes 1 Reputation point
2022-07-07T07:33:21.243+00:00

Hi,
I have an entry that's IsVisible property is set to false. Then I have a button that has a clicked event handler that sets the entry IsVisible to true and sets the focus and cursor position of the entry. The entry_focused event handler is fired, but there is no focus /cursor on the entry and no keyboard appears.

Here is the Button_Clicked event handler:

void Button_Clicked(System.Object sender, System.EventArgs e)  
    {  
        //doesn't show cursor  
        AmntEntry.IsVisible = true;  
        AmntEntry.Focus();  
        AmntEntry.CursorPosition = 2;  
    }  

Please let me know how to fix this.
Thanks

Developer technologies | .NET | Xamarin
Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.