BaseListBoxControl.FindItem(Int32, Boolean, ListBoxFindItemDelegate) Method
Searches for the first list box item in the specified direction from the specified index, using a cusom algorithm.
Namespace: DevExpress.XtraEditors
Assembly: DevExpress.XtraEditors.v24.2.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
startIndex | Int32 | An integer value providing the zero-based index of the start item. |
upDown | Boolean | true to search to the end of the item list; false to search to the beginning of the item list. |
predicate | DevExpress.XtraEditors.ListBoxFindItemDelegate | A delegate that is called when searching for a list box item. |
Returns
Type | Description |
---|---|
Int32 | An integer value representing the zero-based index of the first item found. -1 if no item is found. |
Remarks
The following example shows how to search for the item whose DisplayText matches the specified text.
using DevExpress.XtraEditors;
private int Find(int startIndex, string searchText) {
return listBoxControl1.FindItem(startIndex, true, delegate(ListBoxFindItemArgs e) {
e.IsFound = searchText.Equals(e.DisplayText);
});
}
//The same method implemented using lambda expressions
private int Find2(int startIndex, string searchText) {
return listBoxControl1.FindItem(startIndex, true, (ee)=>ee.IsFound = searchText.Equals(ee.DisplayText));
}
See Also