SearchForVirtualItemEventArgs.IsTextSearch Свойство

Определение

Получает значение, указывающее, является ли этот поиск текстовым поиском.

public:
 property bool IsTextSearch { bool get(); };
public bool IsTextSearch { get; }
member this.IsTextSearch : bool
Public ReadOnly Property IsTextSearch As Boolean

Значение свойства

Значение true, если поиск является текстовым; значение false, если поиск является поиском местоположения.

Примеры

В следующем примере кода показано использование этого элемента. В этом примере обработчик событий сообщает о возникновении ListView.SearchForVirtualItem события. Этот отчет поможет вам узнать, когда происходит событие, и может помочь в отладке. Чтобы сообщить о нескольких событиях или о событиях, которые происходят часто, рекомендуется заменить MessageBox.ShowConsole.WriteLine сообщение на или добавить его в многостроочный TextBox.

Чтобы выполнить пример кода, вставьте его в проект, содержащий экземпляр типа ListView с именем ListView1. Затем убедитесь, что обработчик событий связан с событием ListView.SearchForVirtualItem .

private void ListView1_SearchForVirtualItem(Object sender, SearchForVirtualItemEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "IsTextSearch", e.IsTextSearch );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "IncludeSubItemsInSearch", e.IncludeSubItemsInSearch );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Index", e.Index );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "IsPrefixSearch", e.IsPrefixSearch );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Text", e.Text );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "StartingPoint", e.StartingPoint );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Direction", e.Direction );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "StartIndex", e.StartIndex );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "SearchForVirtualItem Event" );
}
Private Sub ListView1_SearchForVirtualItem(sender as Object, e as SearchForVirtualItemEventArgs) _ 
     Handles ListView1.SearchForVirtualItem

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "IsTextSearch", e.IsTextSearch)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "IncludeSubItemsInSearch", e.IncludeSubItemsInSearch)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Index", e.Index)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "IsPrefixSearch", e.IsPrefixSearch)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Text", e.Text)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "StartingPoint", e.StartingPoint)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Direction", e.Direction)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "StartIndex", e.StartIndex)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"SearchForVirtualItem Event")

End Sub

Комментарии

Вы можете выполнить поиск ListView элемента управления по расположению FindNearestItem с помощью метода или выполнить текстовый поиск с помощью FindItemWithText метода .

Применяется к