Setting the Focus to an Entry in Xamarin.Forms

后端 未结 6 888
天命终不由人
天命终不由人 2020-12-20 13:58

This is just a simplified example, but I\'m trying to set this up so that when I open up this page in my Application, the first thing that happens is the keyboard pops up re

6条回答
  •  被撕碎了的回忆
    2020-12-20 14:09

    Use the Focus method

    nameentry.Focus();
    

    If you want the focus to be set when your page appears, you should probably do this in the OnAppearing method

        protected override void OnAppearing ()
        {
            base.OnAppearing ();
    
            nameentry.Focus();
        }
    

提交回复
热议问题