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

  • SEARCH
  • Home
  • 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 6328793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:31:33+00:00 2026-05-24T17:31:33+00:00

I’m using ObservableCollection s as the ItemsSource for some of my bindings, and have

  • 0

I’m using ObservableCollections as the ItemsSource for some of my bindings, and have run into a scenario where I would like to call OnCollectionChanged manually to notify that the list should be re-checked by the binding engine. (The BindingList analogue is OnListChanged).

Here’s where the trouble begins. Maddeningly, these methods are protected and can’t be called without subclassing these types. Ironpython supports this, but when I attempt to subclass, it fails spectacularly – even when I don’t specify any overriding methods:

>>> class ObservableCollectionEx(System.Collections.ObjectModel.ObservableCollection):
...     pass
... 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
SystemError: Object reference not set to an instance of an object.

>>> class BindingListEx(System.ComponentModel.BindingList):
...     pass
... 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
SystemError: Object reference not set to an instance of an object.

I’m about to give up, and all I wanted to do was make one friggin’ call to OnCollectionChanged! 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-24T17:31:34+00:00Added an answer on May 24, 2026 at 5:31 pm

    After doing some more research I’ve found a workaround. Reading this article on inheriting from generic classes sheds some light on what is going on behind the scenes, most notably this explanation:

    Closed Construct generic is the term used to refer a scenario where a sub-class is non-generic and the base class is parameterized as concrete type.

    public class SubClass : BaseClass<int>   {...}
    

    Open Construct generic is the term used to refer a scenario where both the base and sub-class is parameterized as generic type.

    public class SubClass<T> : BaseClass<T> {...}
    

    According to this, what I’m trying to do in my original post (inheriting from ObservableCollections and BindingLists) is of the second form; trying to keep both the base and sub-class parameterized. While I still think this has to be possible in some way in IronPython, I can’t figure out the syntax to do it, so I’ll settle for the first form for now. And whaddaya know, it works:

    >>> class BindingListEx(System.ComponentModel.BindingList[str]):
    ...     pass
    ... 
    >>> 
    >>> b = BindingListEx()
    >>> b
    <BindingListEx object at 0x000000000000002C>
    >>> b.Add(3)
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    TypeError: expected str, got int
    >>> b.Add("cow")
    >>> 
    

    So in this example, BindingListEx is non-generic, and subclasses from the BindingList parameterized base class that has been fed str as its parameter. This works for now. If anyone figures out how to do Open Construct generic inheritance (that second form up there), feel free to post it here and you’ll get the accepted answer, as that was my original goal. For now, this will have to do.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have a French site that I want to parse, but am running into
I have thousands of HTML files to process using Groovy/Java and I need to

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.