xaml - 在 Xamarin.Forms PCL XAML 页面中禁用自动完成

标签 xaml mvvm portable-class-library xamarin.forms

我有一个 PCL,它将我的 MVVM 页面存储在 XAML 中。我在 XAML 文件中有以下内容,但我想禁用键盘上的自动完成功能。有谁知道我如何在 XAML 中做到这一点?

<Entry Text="{Binding Code}" Placeholder="Code" />

最佳答案

定制 Keyboard可以使用 x:FactoryMethod 在 XAML 中创建实例属性。您可以使用以下标记实现您想要的:

<Entry Text="{Binding Code}" Placeholder="Code">
  <Entry.Keyboard>
    <Keyboard x:FactoryMethod="Create">
      <x:Arguments>
        <KeyboardFlags>None</KeyboardFlags>
      </x:Arguments>
    </Keyboard>
  </Entry.Keyboard>
</Entry>
KeyboardFlags.None从该字段中删除所有特殊键盘功能。

Multiple enums可以在 XAML 中通过用逗号分隔它们来指定:
<KeyboardFlags>CapitalizeSentence,Spellcheck</KeyboardFlags>

当您不需要自定义时 Keyboard ,您可以使用 one of the predefined ones利用 x:Static属性:
<Entry Placeholder="Phone" Keyboard="{x:Static Keyboard.Telephone}" />

关于xaml - 在 Xamarin.Forms PCL XAML 页面中禁用自动完成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26966404/

相关文章:

c# - XAML:从父 View 设置属性?

c# - 如何将 TextBlocks 动态添加到 RelativePanel?

javascript - KnockoutJS 中的 subview 模型在 Internet Explorer 8 中引发异常

sqlite - Xamarin PCL和sqlite.net

flutter - 我们可以在flutter包项目中创建像.dll这样的共享库或程序集吗?

c# - 可移植类库和 WebRequest.ContentLength

c# - WPF 中的多个变换效果

c# - Windows 8 XAML Metro App 中的基本 UserControl 类

c# - 为 TextBox 或代码解决方法寻找 DisplayMemberPath 的替代方法

c# - 从屏幕继承的单元测试 View 模型 (Caliburn.Micro)