I need to create a custom TextEdit-like control that supports the following features:1. Use regex edit masks
2. Provide AutoComplete functionality
3. Support use of buttons.
My current approach was to change the behavior of a ComboBox accordingly. This already works for requirement 1 and 3; however, the AutoComplete does not work properly. The suggestion is shown in the popup, but the user can neither select the suggestion with the arrow key nor by clicking on it. The Text/EditValue does not change. I read that there should be a PopUpClosed event I could register and then update the Text accordingly, but it seems this is just available for WPF ComboBoxes?!
Note: my ComboBox does not have/need any Items. The whole control should just allow the user to enter a valid value which is backed by an own datasource for auto completion.
I currently activate the AutoComplete functionality of the ComboBox that way:[C#]
this.MaskBox.AutoCompleteSource = AutoCompleteSource.CustomSource; this.MaskBox.AutoCompleteMode = AutoCompleteMode.Suggest; this.MaskBox.AutoCompleteCustomSource = new AutoCompleteStringCollection(); this.MaskBox.AutoCompleteCustomSource.AddRange(autoCompleteSource);
Trying to use other controls as base for my control, I had to face different other problems:
LookUpEdit supports requirement 2 and 3, but not 1
TextEdit supports 1 and 2 but not 3.
Do you have any idea what to use to support all 3 requirements?
Internally, our editors own a text box that implements the text input functionality. The text box is represented by the TextBoxMaskBox class. It is descendant of a standard TextBox control's . So, the auto complete feature is provided by the standard TextBox.
If you have managed with implementation the 1 and 2 features for TextEdit, I suggest you apply your approach for ButtonEdit. It is the closest editor to TextEdit that supports adding buttons. Please test this and let me know your results.