Subclassing FilteredBindingList

Subclassing FilteredBindingList

Old forum URL: forums.lhotka.net/forums/t/2787.aspx


bgilbert posted on Thursday, April 26, 2007

I'd like to subclass FilteredBindingList similar to the way I subclassed SortedBindingList. I did the sorted list like this:
Public Class MySortedBindingList(Of TList As Generic.IList(Of TItem), TItem)
    Inherits SortedBindingList(Of TItem)

    Private mSource As TList = Nothing

    Public Sub New(ByVal list As TList)
        MyBase.New(list)     
        Me.mSource = list
    End Sub
 Public ReadOnly Property List() As TList
        Get
            Return Me.mSource
        End Get
    End Property

This gave me access to the source list, which is useful for getting at it's properties. Now I'm trying to do the same with the FilteredBindingList. However, unlike the SortedBindingList, in which I can declare a property exposing the original list, I cannot seem to set a property and expose the filtered version of the list.

One thing I want to be able to do is to pass a filtered list into a sortedList, as shown on page 76 of the 2.1 book (VB version). However, with my subclassed SortedBindingList, I would need to pass in a strongly-typed list, not a FilteredBindingList object.

Any suggestions?

Copyright (c) Marimer LLC