Note that there are some explanatory texts on larger screens.

plurals
  1. POA list of, list of ObservableCollection<Image> comes up null when looping through it
    primarykey
    data
    text
    <p>I have a collection of collection that's setup like the following.</p> <pre><code>ObservableCollection&lt;ObservableCollection&lt;Image&gt;&gt; _Documents_CompleteClaims= new ObservableCollection&lt;ObservableCollection&lt;Image&gt;&gt;(); </code></pre> <p>And I'm adding a collection to the list like this:</p> <pre><code>this._Documents_CompleteClaims.Add(this._Documents_NewClaimList); </code></pre> <p><strike>When I try to loop through the collection, it shows up null. The collection has an object:</p> <p><img src="https://i.stack.imgur.com/rTobA.png" alt=""></p> <p>But the collection count shows 0.</p> <p><img src="https://i.stack.imgur.com/VT5Xw.png" alt=""></p> <p>I used this same method a while back, but with List instead of ObservableCollection. It worked fine before. Any ideas why observable collections aren't working? Or am I just overlooking something silly?</strike></p> <p>So I misdiagnosed the issue. The problem is that the collection in the collection has no items.</p> <p>This is how I was adding the collection to the list of collections:</p> <pre><code>this._Documents_CompleteClaims.Add(this._Documents_NewClaimList); //Add claim to completed list this._Documents_NewClaimList.Clear(); //Clear out the claim list so we can start a new claim </code></pre> <p>I confirmed that the <strong>_Documents_NewClaimList</strong> collection had items. I thought I could add that collection to the collection of collections and then clear the <strong>_Documents_NewClaimList</strong> collection. But if I comment it out the .Clear() line, it works just fine. So I guess I'll need to remove the items in a different way. Maybe I can add the items to a temporary collection, add that temp collection to the collection of collections, and then clear the old collection.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload