Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Keyboard is not raised after focused event override

$
0
0

Hi, i wanted to change the text of an entry before user starts to type. My code blocked keyboard to raise. User needs to touch again to entry to focus and see the keyboard. Thanks in advance.

ScrollView CreateLayout()
{
    Entry userNameEditor = new Entry() { Text = userNameEditorEmptyString };

    userNameEditor.Focused += (sender, args) => { if (userNameEditor.Text == userNameEditorEmptyString) userNameEditor.Text = userNameEditorPrefilledString; };
    userNameEditor.Unfocused += (sender, args) => { if (userNameEditor.Text == userNameEditorPrefilledString) userNameEditor.Text = userNameEditorEmptyString; };
    ...
}

Viewing all articles
Browse latest Browse all 58056

Trending Articles