首页 > 解决方案 > 如何获得适用于 Windows 平板电脑的数字键盘?

问题描述

我想要 Windows 平板电脑的数字键盘。我用了代码

Keyboard="Numeric"

但它有适用于 Android 设备、iOS 设备和 Windows 手机的数字键盘。它没有为 Windows 平板电脑带来数字键盘。我参考了这个链接,它说在平板电脑中使用数字键盘是不可能的。我想知道有什么办法可以得到这个功能。也许使用自定义渲染器或依赖注入。如果有怎么办?

标签: windowsxamarin.formsuwpkeyboard

解决方案


这是已知问题,已在最新版本中修复,请将 Xamarin.Forms nuget 包版本更新为最新稳定版本(包含在 UWP 客户端项目中)

在此处输入图像描述

更新

[assembly: ExportRenderer(typeof(Entry), typeof(MyEntryRenderer))]
namespace App10.UWP
{ 
    public class MyEntryRenderer : EntryRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                Control.InputScope = Element.Keyboard.ToInputScope();
            }
        }
    }
}

推荐阅读