Scroll editor in Xamarin Forms into view

前端 未结 6 1096
天涯浪人
天涯浪人 2021-02-02 01:49

Using Xamarin Forms, consider the Xaml below.


   

        
6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-02 02:09

    Be careful, the raisekeyboard was just implemented for one entry in the application, if you add a new Entry, the KeyboardHelper.KeyboardChanged is going to shoot, when the focus is in any entry.

    KeyboardHelper.KeyboardChanged += (sender, e) =>{
        bottomOffset = this.ParentView.Bounds.Bottom - _editor.Bounds.Bottom;
        if (KeyboardStatus)
            _editor.TranslationY = e.Visible ? -(e.Height - bottomOffset) : 0;
        else
            _editor.TranslationY = 0;
    };
    

提交回复
热议问题