123456789101112131415161718192021222324252627282930313233 |
- using System.Text.RegularExpressions;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Input;
- using Aitex.Core.UI.MVVM;
- namespace VirgoUI.Client.Models.Utility.EndPoint
- {
- /// <summary>
- /// EndPointView.xaml 的交互逻辑
- /// </summary>
- public partial class EndPointView : UserControl
- {
- public EndPointView()
- {
- InitializeComponent();
-
- }
-
- private void OnPreviewTextInput(object sender, TextCompositionEventArgs e)
- {
- e.Handled = !IsTextAllowed(e.Text);
- }
- private static bool IsTextAllowed(string text)
- {
- Regex regex = new Regex("[^0-9.]+"); //regex that matches disallowed text
- return !regex.IsMatch(text);
- }
- }
- }
|