Hi Miles,
We do not have this functionality build-in, but you can easily implement it.
Here is one example implementation.
Create 2 fields - one will hold all items and second will hold the items that should be displayed:
object
[] m_List;List<object> m_TempList;In the constructor you can initialize both fields and set the m_List with all items in the combo box:
int
count = nComboBox1.Items.Count;m_List =
new object[count];m_TempList = new List<object>();
for (int i = 0; i < count; i++)
{
NListBoxItem item = nComboBox1.Items[i];
m_List[i] = item;
}
Attach to the NComboBox.EditControl.KeyUp event and in the event handler check whether the current text is contained in the items. Then add these items in the m_TempList, and set the combo items to m_TempList:
nComboBox1.EditControl.KeyUp +=
new KeyEventHandler(EditControl_Up);...
void
EditControl_Up(object sender, KeyEventArgs e){
int count = m_List.Length; m_TempList.Clear();
for (int i = 0; i < count; i++) {
NListBoxItem item = (NListBoxItem)m_List[i]; if (item.Text.Contains(nComboBox1.Text)) {
m_TempList.Add(item);
}
}
nComboBox1.Items.Clear();
nComboBox1.Items.AddRange(m_TempList.ToArray());
}
Finally, attach to NComboBox.EditItem.Leave event and put back all items saved in m_List:
nComboBox1.EditControl.Leave +=
new EventHandler(EditControl_Leave);...
void
EditControl_Leave(object sender, EventArgs e){
nComboBox1.Items.Clear();
for (int i = 0; i < m_List.Length; i++) {
nComboBox1.Items.Add(m_List[i]);
}
}
I hope this example will help.
Regards,
Angel.