Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 597673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:18:21+00:00 2026-05-13T16:18:21+00:00

From what I’ve learned, you can’t cast to BindingList, but rather you can wrap

  • 0

From what I’ve learned, you can’t cast to BindingList, but rather you can wrap your result from the Linq query with a NEW BindingList. However, this doesn’t work for me, because my Original Binding list has some events attached to it and i would like to maintain the same events in my LINQ result set.

For example:

I have my main BindingList collection called “Reports” (of type IReport). This collection is being registered to an event as following:
Reports.AddingNew += OnAddNewXReport;

now, when i would like to filter this big collection and extract only few matched items, i’m using Linq to get this matching list. To make this list a BindingList, i new to do the following:

var rs = Reports.Where(r => r.ReportType == ReportType.MyType).Select(o => (MyType) o);

return new BindingList<MyType>(rs.ToList());

As you can see, this newly created collection, will not fire when new item is being added.

Does anyone has any idea how to resolve this? is there anyway to close the event subscription from the original BindingList to the “filtered” BindingList?

Thanks for the help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T16:18:21+00:00Added an answer on May 13, 2026 at 4:18 pm

    I dont think there is an easy way to do this. I would make a derived BindingList<T> that chains and exposes the events you’re interested in.

    sealed class MyBindingList<T> : BindingList<T>
    {
        public event EventHandler MyAddingNew;
    
        public MyBindingList(IList<T> collection)
            : base(collection)
        {
            //hook so that when BindingList.AddingNew is fired
            //it is chained to our new event
            base.AddingNew += MyBindingList_AddingNew;
        }
    
        public void MyBindingList_AddingNew(object sender, AddingNewEventArgs e)
        {
            if (MyAddingNew != null)
                MyAddingNew(sender, e);
        }
    
        public void RegisterEvents(MyBindingList<T> src)
        {
            //this is where you assign src events to your new list
            this.MyAddingNew = src.MyAddingNew;
        }
    } 
    

    Reason why you would need a derived type is that you cannot assign EventHandlers using just = (this.AddingNew = src.AddingNew) unless you’re in the scope that defines it. When translated into your code you would have :

    MyBindingList<MyType> Reports;
    Reports.MyAddingNew += OnAddNewXReport;
    var rs = Reports.Where(r => r.ReportType == ReportType.MyType)
                    .Select(o => (MyType) o);    
    
    MyBindingList<MyType> FilteredReports = new MyBindingList<MyType>(rs.ToList());
    FilteredReports.RegisterEvents(Reports);
    return FilteredReports;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From organizer window i can copy document directory data. But in some apps i
From this article I see I can use msbuild to apply configuration transformations but
From what I can gather, there are three categories: Never use GET and use
From the should be simple, but... files: Trying to get started with jQuery UI.
From what I have gathered, one can have both editions of Delphi installed. My
Does anyone know how can I replace this 2 symbol below from the string
From this string: $input = Some terms with spaces between; how can I produce
From here http://blog.prabir.me/post/Undo-in-Git.aspx , it said This undo’s your commit and also resets your
From a web developer point of view, what changes are expected in the development
From a desktop application developer point of view, is there any difference between developing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.