Example #1
0
        private void InputPaneHiding(InputPane sender, InputPaneVisibilityEventArgs e)
        {
            if (displacement != 0.0)
            {
                MoveMiddleOnShowing.Stop();

                // Keep in mind that other elements could be shifting out of your control. The sticky app bar, for example
                // will move on its own. You should make sure the input element doesn't get occluded by the bar
                bottomOfList = MiddleScroller.VerticalOffset + MiddleScroller.ActualHeight;

                // If the middle area has actually completed resize, then we want to ignore
                // the default system behavior
                if (resized)
                {
                    // Be careful with this property. Once it has been set, the framework will not change
                    // any layouts in response to the keyboard coming up
                    e.EnsuredFocusedElementInView = true;
                }

                // If the container has already been resized, it should be sized back to the right size
                // Otherwise, there's no need to change the height
                if (Double.IsNaN((double)Container.GetValue(Grid.HeightProperty)))
                {
                    MoveMiddleOnHiding.Begin();
                }
                else
                {
                    shouldResize = ResizeType.ResizeFromHide;
                    Container.ClearValue(Grid.HeightProperty);
                }
            }
        }
Example #2
0
        private void CustomKeyboardHandler(object sender, InputPaneVisibilityEventArgs e)
        {
            // This function animates the middle scroll area up, then resizes the rest of
            // the viewport. The order of operations is important to ensure that the user
            // doesn't see a blank spot appear behind the keyboard
            viewSize = e.OccludedRect.Y;

            // Keep in mind that other elements could be shifting out of your control. The sticky app bar, for example
            // will move on its own. You should make sure the input element doesn't get occluded by the bar
            displacement = -e.OccludedRect.Height;
            bottomOfList = MiddleScroller.VerticalOffset + MiddleScroller.ActualHeight;

            // Be careful with this property. Once it has been set, the framework will
            // do nothing to help you keep the focused element in view.
            e.EnsuredFocusedElementInView = true;

            ShowingMoveSpline.Value = displacement;
            MoveMiddleOnShowing.Begin();
        }