简体   繁体   English

Xamarin 社区工具包 MaskedBehavior 中的可变长度

[英]Variable length in Xamarin Community Toolkit MaskedBehavior

I'm trying to use the Xamarin Community Toolkit MaskedBehavior in my app for phone extensions which can be 2, 3 or even up to 6 digits long.我正在尝试在我的应用程序中使用 Xamarin 社区工具包MaskedBehavior进行电话分机,其长度可以是 2、3 甚至最多 6 位数字。

It's easy to define the mask if it's a set length but how do I use it in this case where I want the user to enter only numeric values but the length can be anywhere from 2 to 6 digits?如果掩码是固定长度,则很容易定义掩码,但在这种情况下我如何使用它,我希望用户仅输入数值但长度可以是 2 到 6 位数字?

<Entry
    Placeholder="Ext"
    Text="{Binding Extension}"
    Keyboard="Numeric">
    <Entry.Behaviors>
       <xct:MaskedBehavior
           Mask="X?????"/>
    </Entry.Behaviors>
</Entry>

Turns out, I don't have to do anything.事实证明,我不需要做任何事情。 When I set the mask as Mask="XXXXXX" , it will accept any number of digits up to 6. It doesn't force the user to always enter six digits.当我将掩码设置为Mask="XXXXXX"时,它将接受最多 6 位的任意数字。它不会强制用户始终输入六位数字。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Xamarin 社区工具包 TabView 高度 - Xamarin Community Toolkit TabView height Xamarin 社区工具包弹出MVVM绑定问题 - Xamarin Community Toolkit Popup MVVM Binding Issue Xamarin 社区工具包 TabView - 在选项卡内导航 - Xamarin Community Toolkit TabView - Navigate within Tabs Xamarin Community Toolkit 输入验证在设置 BindingContext 时为真 - Xamarin Community Toolkit input validation is true when BindingContext is set 重新选择当前选项卡以刷新 Xamarin 社区工具包上 TabView 控件上的页面 - ReSelect the current tab to refresh the Page on TabView Control on Xamarin Community Toolkit Xamarin 社区工具包 MediaPlayer 自动播放不起作用? - Xamarin Community Toolkit MediaPlayer AutoPlay doesn't work? 如何设置 Xamarin Community Toolkit Popup 的大小以在 Xamarin Forms 中动态包装内容? - How to set size of Xamarin Community Toolkit Popup to wrap content dynamically in Xamarin Forms? Xamarin.Forms iOS 处于发布模式的应用程序 Community Toolkit TouchEffect 命令未触发 - Xamarin.Forms iOS app in Release mode Community Toolkit TouchEffect command not firing Xamarin 社区工具包 MediaElement 未显示播放控件或播放源中的视频 UWP - Xamarin Community Toolkit MediaElement not showing an Playback controls or play the video in the source UWP 如何在C#代码后面使用Xamarin Community Toolkit扩展属性和属性? - How to use Xamarin Community Toolkit extension properties and attributes in the C# code behind?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM