WPF 中的分段文本框
有谁知道免费或商业 WPF 控件会执行以下操作:
每个框 X 个字符,并且自动- 完成每个框后按 Tab 键跳到下一个框?类似于为 Microsoft 产品输入许可证密钥的方式。
我认为从头开始做起来并不是特别困难,但如果已经存在一个很好的例子,我想避免重新发明轮子。
Is anyone aware of a free or commercial WPF control that would do something like this:
X character per box, and auto-tabbing to the next box as you complete each box? Similar to the way that license keys are entered for Microsoft products.
I don't think it would be particularly hard to do from scratch, but I'd like to avoid reinventing the wheel if a good example of this already exists.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
WPF 提供了您所需的一切,除了自动跳到下一个控件之外。行为可以提供该功能,结果如下所示:
这是 KeyText 和 KeyTextCollection 类(根据口味进行调整):
这是实现自动选项卡和焦点选择的行为:
如果您不熟悉行为,安装 Expression Blend 4 SDK 并添加此命名空间:
并将
System.Windows.Interactivity
添加到您的项目中。WPF provides all you need except auto-tabbing to the next control. A behavior can provide that functionality and the result looks like this:
Here are the KeyText and KeyTextCollection classes (adjust to taste):
And here is the behavior that implements auto-tab and select-on-focus:
If you are not familiar with behaviors, Install the Expression Blend 4 SDK and add this namespaces:
and add
System.Windows.Interactivity
to your project.