How to make a text change event in a comboBox user?
The textInput event does not work, and textChanged , as in the textBox , does not.
1 answer
You can use property binding. In DataContext'е , you must have an object that has a property with which you want to associate the Text property from the ComboBox'а .
XAML
<ComboBox Text="{Binding Text}" IsEditable="True" /> C # CODE
public class Content { string text; public string Text { get { return text; } set { text = value; OnTextChanged(); } } void OnTextChanged() { // Ваш код здесь } } public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); DataContext = new Content(); } } |
PreviewTextInput, as advised by MSDN here msdn.microsoft.com/ru-ru/library/… - rdorn