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 363465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:20:43+00:00 2026-05-12T13:20:43+00:00

Hey guys, I’m having problems with the ItemContainerGenerator in Silverlight 3. In my derived

  • 0

Hey guys, I’m having problems with the ItemContainerGenerator in Silverlight 3.

In my derived Custom ListBox I’m adding this handler:

ItemContainerGenerator.ItemsChanged += new ItemsChangedEventHandler(ItemContainerGenerator_ItemsChanged);

Every time the Items change I’m getting a call back. Fine so far.

Now in the ItemContainerGenerator_ItemsChanged I want to do different things depending on the action like this:

            switch (e.Action)
        {
            case NotifyCollectionChangedAction.Add:
                Debug.WriteLine("items added");
                break;
            case NotifyCollectionChangedAction.Remove:
                Debug.WriteLine("items removed");
                break;
            case NotifyCollectionChangedAction.Replace:
                Debug.WriteLine("items removed");
                break;
            case NotifyCollectionChangedAction.Reset:
                Debug.WriteLine("items reset, itemscount:" + this.Items.Count);

                CalcMaxColumnWidths();

                break;
            default:
                break;
        }

Everything works fine until now. In the CalcMaxColumnWidths() i call when the action is reset I do this:

foreach (ListBoxItem item in ItemsControlExtensions.GetContainers(this))
        { //some code here }

Here’s the problem:

The Containers I’m trying to get with the GetContainers() method returns null, even though the Items.Count is the correct value (60).

In WPF there was a ItemContainerGenerator.Status, so we could wait until that was set to Done and then iterate over the containers.

How can i solve this in Silverlight? (without any Timers!)

Thanks for your 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-12T13:20:43+00:00Added an answer on May 12, 2026 at 1:20 pm

    Instead of doing all the magic in the ListBox itself, I ended up creating a custom Panel and using it as the ItemPanel.
    In the Panel’s Measure and Arrange cycles I calculate the Column Widths now. In these cycles all the containers are already created. Problem solved.

    But it still sucks that the Status is missing from the ItemContainerGenerator.

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

Sidebar

Related Questions

hey guys having this really simple problem but cant seem to figure out have
Hey guys am having a bit of problems with my jQuery, I have all
Hey guys i'm having a few problems with Apple's reachability code. What i've found
Hey guys Im attempting to sort a linked list and having trouble with this
Hey guys this is my html code: <div class=nakupy> <li class=icn_kategorie><a href=#>Nákupy</a> <div class=sub_menu>
Hey guys (and gals) I'm having a problem using Assembly GetExportedTypes() in .NET 4.0.
Hey guys I've written this MS SQL script with my awesome MS SQL skills,
Hey guys, sorry I'm kind of new to programming, but I had a small
Hey Guys I've been struggling with this for the last hour and pouring over
hey guys, how can I just achieve this simple layout? I'm hoping the answer

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.