示例#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);
                }
            }
        }
示例#2
0
        private void MiddleScroller_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            // Scrolling should occur after the scrollable element has been resized to ensure
            // that the items the user was looking at remain in view
            if (shouldResize == ResizeType.ResizeFromShow)
            {
                resized      = true;
                shouldResize = ResizeType.NoResize;
                MiddleScroller.ChangeView(null, bottomOfList - MiddleScroller.ActualHeight, null, true);
            }
            else if (shouldResize == ResizeType.ResizeFromHide)
            {
                shouldResize      = ResizeType.NoResize;
                MiddleTranslate.Y = displacement;
                MiddleScroller.ChangeView(null, bottomOfList - MiddleScroller.ActualHeight, null, true);

                displacement = 0;
                resized      = false;

                MoveMiddleOnHiding.Begin();
            }
        }