Does anyone have an example of how I could implement an ApplyFilter method for FilteredBindingList other than the standard one which uses the "contains" logic.
I'd actually like to subclass FBL to have a number of different filter operators, but I'm complete unfamiliar with the C# code that this version is created with.
Would I be correct in thinking that the actual code that does the comparing is the method "Filter" in the DefaultFilter class?
How would I go about implementing a custom filter?
Any help would be appreciated.
never mind. I figured it out.
I created a "CustomFilters" class, and created a number of methods, e.g.
Public Shared Function DateGEFilter(ByVal item As Object, ByVal filterValue As Object) As Boolean
Dim columnvalue As String = item.ToString
' assume filter is an array of string
Dim value As String = CType(filterValue, String)
If CType(columnvalue, DateTime) >= CType(value, DateTime) Then
' found a match
' didn't find a match
Called from my app. like so -
Dim fLIST As New Csla.FilteredBindingList(Of ContractInfo)(list)
fLIST.FilterProvider = AddressOf CustomFilters.DateGEFilter
fLIST = New Csla.FilteredBindingList(Of ContractInfo)(fLIST)
fLIST.FilterProvider = AddressOf CustomFilters.DateLEFilter
Woohoo! works great!
Copyright (c) Marimer LLC