Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 WPF 文本框,并执行以下操作
哪个事件/事件参数可以告诉我在位置 4 输入了 0。我需要在预览级别知道这一点,以便我可以根据前缀和后缀数字拒绝字符 0。
在 PreviewTextInput 事件中,您可以使用 TextBox 的CaretIndex属性来了解输入输入的位置。
您可以使用 PreviewTextInput 事件。(完整示例请参见此处)