void OnKeyboardShow(object sender, UIKeyboardEventArgs args) { ThreadDetailsPage threadDetailsPage = Element as ThreadDetailsPage; if (threadDetailsPage == null) { return; } NSValue result = args.Notification.UserInfo.ObjectForKey(new NSString(UIKeyboard.FrameEndUserInfoKey)) as NSValue; if (result == null) { return; } Console.WriteLine("Show Keyboard ThreadDetailsPage " + result); CGSize keyboardSize = result.RectangleFValue.Size; Console.WriteLine(keyboardSize); if (savedBounds == false) { savedBounds = true; bounds = Element.Bounds; } var newBounds = new Rectangle(bounds.Left, bounds.Top, bounds.Width, App.Current.MainPage.Height - keyboardSize.Height - 100); Element.Layout(newBounds); }
void OnKeyboardHide(object sender, UIKeyboardEventArgs args) { ThreadDetailsPage threadDetailsPage = Element as ThreadDetailsPage; if (threadDetailsPage == null) { return; } NSValue result = (NSValue)args.Notification.UserInfo.ObjectForKey(new NSString(UIKeyboard.FrameEndUserInfoKey)); Console.WriteLine("Hide Keyboard ThreadDetailsPage " + result); Element.Layout(bounds); savedBounds = false; }