IBindingList.SupportsSearching IBindingList.SupportsSearching IBindingList.SupportsSearching IBindingList.SupportsSearching Property

정의

목록이 Find(PropertyDescriptor, Object) 메서드를 사용한 검색 기능을 지원하는지 여부를 가져옵니다.Gets whether the list supports searching using the Find(PropertyDescriptor, Object) method.

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

속성 값

목록에서 Find(PropertyDescriptor, Object) 메서드를 사용한 검색 기능을 지원하면 true이고, 그렇지 않으면 false입니다.true if the list supports searching using the Find(PropertyDescriptor, Object) method; otherwise, false.

예제

다음 코드 예제를 구현 하는 방법에 설명 합니다 SupportsSearching 속성입니다.The following code example demonstrates how to implement the SupportsSearching property.

    public class MyFontList : BindingList<Font>
    {

        protected override bool SupportsSearchingCore
        {
            get { return true; }
        }
        protected override int FindCore(PropertyDescriptor prop, object key)
        {
            // Ignore the prop value and search by family name.
            for (int i = 0; i < Count; ++i)
            {
                if (Items[i].FontFamily.Name.ToLower() == ((string)key).ToLower())
                    return i;

            }
            return -1;
        }


    }
  
}
Public Class MyFontList
    Inherits BindingList(Of Font)

    Protected Overrides ReadOnly Property SupportsSearchingCore() As Boolean
        Get
            Return True
        End Get
    End Property
    
    Protected Overrides Function FindCore(ByVal prop As PropertyDescriptor, _
        ByVal key As Object) As Integer
        ' Ignore the prop value and search by family name.
        Dim i As Integer
        While i < Count
            If Items(i).FontFamily.Name.ToLower() = CStr(key).ToLower() Then
                Return i
            End If
            i += 1
        End While

        Return -1
    End Function
End Class

적용 대상