Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Programatically Select all text in UITextField

$
0
0

When a UITextField receives focus, I want the text inside of it to be automatically selected so that anything the user types overwrites it. I've tried the following, but nothing work (iOS 7.1.1):

UserNameField.EditingDidBegin += (object sender, EventArgs e) =>
{
    UserNameField.SelectAll(this);
};
or
UserNameField.EditingDidBegin += (object sender, EventArgs e) =>
{
    UserNameField.GetTextRange (UserNameField.BeginningOfDocument, UserNameField.EndOfDocument);
};
Has anybody experiences with that? Thanks

Viewing all articles
Browse latest Browse all 204402

Trending Articles