如何在Windows 10中管理虚拟键盘(SIP)以适应视图控件?

时间:2015-08-31 07:31:57

标签: c# windows-8 windows-10

是否有教程或基本说明,其中记录了如何管理Windows 10中的软输入面板(SIP)以适应视图控件?

基本上,现在当虚拟键盘出现在我的Windows 10 Phone应用程序中时,它会隐藏文本框和底部工具栏。我需要重新调整视图的控件,但我无法了解事件,模式等信息。

1 个答案:

答案 0 :(得分:0)

请参阅:Respond to the presence of the touch keyboard

例如:

    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        mInputPane = InputPane.GetForCurrentView();
        mInputPane.Showing += InputPane_Showing;
        mInputPane.Hiding += InputPane_Hiding; 
    }

...

    private void InputPane_Showing(InputPane sender, InputPaneVisibilityEventArgs args)
    {
        // Keyboard showing, get the size of the keyboard and adjust view.

        double keyboardHeight = args.OccludedRect.Height;

        aGridRow.Height = new GridLength(keyboardHeight);

        // Inform the system we have handled making the required UI visible.
        args.EnsuredFocusedElementInView = true;
    }

...

    private void InputPane_Hiding(InputPane sender, InputPaneVisibilityEventArgs args)
    {
        // Keyboard has disappeared, reset the view.

        aGridRow.Height = new GridLength(0);
        args.EnsuredFocusedElementInView = true;
    }