Use custom filtering to search in all columns of RadMultiColumnComboBox.
Product Version | Product | Author | Last modified |
---|---|---|---|
2014.1.402 | RadMultiColumnComboBox for WinForms | Dimitar Karamfilov | February 13, 2014 |
This example shows how you can search in all columns in RadMultiColumnComboBox, rather than filtering by just a single column. The example uses the CustomFiltering event of the EditorElement to perform a custom search. In this case we will search the entire underlying grid for the text in the editor and if a match is found, we will mark the corresponding cell in a specific color.
First we can initialize the control. To do that we can populate it with some data, enable the filtering by setting the appropriate properties (AutoFilter, DisplayMember) and add a custom FilterDescriptor (without this the CustomFiltering event won't fire). Also we should subscribe to the CustomFiltering and KeyDown events:
Now we can implement the CustomFiltering event handler. In it we will use a string variable to store the searched text (note that the text is corrected depending on the AutoCompleteMode). Also if the user clears the text we need to make sure that all rows are visible and their styles are reset. Finally we can iterate trough each cell of the current row and if it contains the searched text we can change its style:
Finally we can use the KeyDown event in order to select the corresponding row (the DisplayMember text will be displayed in the textbox) when the user presses the enter key:
You can download a VB and C# project from the following link.