In a Windows 8 application, Input Panel pops up when the TextBox control gets the focus, and if the TextBox control is in the lower half of the page, the system pushes the page up the textbox is not covered by the Input Panel, but when the textbox is in the Flipview control , the system does not push the page, so the input box is covered by the Input Panel. The specific reason is not clear, do not know is not a system bug.
When the Input Panel pops up, the action on the page can be handled by listening to the inputpane showing and hiding events, since when the textbox is in the Flipview control, the system does not have a good processing page to push, Then the developer can handle the push by listening to Inputpane events.
An instance code for Windows 8 responding to the appearance of the On-Screen Keyboard sample describes what to do if the listener handles Inputpane, reference this instance to the T in Flipview The Extbox control is an example and simplifies processing of the instance code.
The inputpanehelper in the instance is the encapsulation of Inputpane event handling, used directly, Inputpanehelper code as follows:
Using System;
Using System.Collections.Generic;
Using Windows.UI.ViewManagement;
Using Windows.UI.Xaml;
Using Windows.foundation;
Using Windows.UI.Xaml.Media.Animation; Namespace Huizhang212.keyboard {public delegate void Inputpaneshowinghandler (object sender, Inputpanevisibili
Tyeventargs e);
public delegate void Inputpanehidinghandler (Inputpane input, Inputpanevisibilityeventargs e);
public class Inputpanehelper {private dictionary<uielement, inputpaneshowinghandler> Handlermap;
Private UIElement lastfocusedelement = null;
Private Inputpanehidinghandler hidinghandlerdelegate = null; Public Inputpanehelper () {handlermap = new dictionary<uielement, inputpaneshowinghandler>
(); } public void Subscribetokeyboard (bool subscribe) {Inputpane input = Inputpa Ne.
Getforcurrentview (); if (subscribe) {input.
showing + = Showinghandler; Input.
hiding + = Hidinghandler; else {input.
Showing-= Showinghandler; Input.
hiding-= Hidinghandler;
} public void Addshowinghandler (uielement element, Inputpaneshowinghandler handler) {if (Handlermap.containskey (element)) {throw new System.Exception (
"A handler is already registered!");
else {Handlermap.add (element, handler); Element.
GotFocus + = Gotfocushandler; Element.
LostFocus + = Lostfocushandler;
} private void Gotfocushandler (object sender, RoutedEventArgs e) {
Lastfocusedelement = (UIElement) sender; } private void Lostfocushandler (object sender, RoutedEventArgs e) {if
(Lastfocusedelement = = (UIElement) sender)
{lastfocusedelement = null;
} private void Showinghandler (Inputpane sender, Inputpanevisibilityeventargs e) {if (lastfocusedelement!= null && handlermap.count > 0) {h
Andlermap[lastfocusedelement] (lastfocusedelement, E);
} lastfocusedelement = null;
private void Hidinghandler (Inputpane sender, Inputpanevisibilityeventargs e) {
if (hidinghandlerdelegate!= null) {hidinghandlerdelegate (sender, E);
} lastfocusedelement = null;
} public void Sethidinghandler (Inputpanehidinghandler handler) {this.hidinghandlerdelegate = handler; public void Removeshowinghandler (UIElement element) {Handlermap.remove (ele
ment); Element.
GotFocus-= Gotfocushandler; Element.
LostFocus-= Lostfocushandler; }
}
}