Open hassaanmasood opened 2 years ago
@kmgallahan I already had a look at the link you mentioned. But my problem actually is more specific to an editable combobox. These textbox extensions do not work on editable comboboxes. One thing I forgot to mention is I specifically faced this issue with WinUI3 in desktop apps not UWP. Not sure if there's already a workaround in them
@MikeHillberg Is there a different way of doing this for editable combo box?
Can you use the TextBox.BeforeTextChanging event? This is intended for text filtering scenarios.
Coming from WPF, I am finding it nearly impossible to filter out characters on TextBoxes or Editable ComboBoxes in WinUI Controls. There are no specific events available in WinUI.
In WPF, we can easily filter out unwanted characters using PreviewTextInput event. The nearest event available in WinUI is PreviewKeyDown but 'Microsoft.UI.Xaml.Input.KeyRoutedEventArgs' argument uses Windows.System.VirtualKey enum which does not have mapping for all the keys and hence if you try to cast these enums to chars, many keys are cast to the wrong value and the filtering does not work as intended.
I am specifically referring to WinUI 3 in desktop apps.