Skip navigation

So I finally upgraded my machine to the June CTP of .NetFX3 and found my code was broken.
 
Basically it was complaining that an ObservableCollection in my control was null during initialization. In Beta 2 it would just initialize my collection for me. Before this code would work
 
<tempNS:MyControl>
   <tempNS:MyControl.MyCollection>
        <tempNS:MyCollectionItem …./>
        <tempNS:MyCollectionItem …./>
        <tempNS:MyCollectionItem …./>
   </tempNS:MyControl.MyCollection>
</tempNS:MyControl>
Now I have to explicitly declare the new collection like so:
<tempNS:MyControl>
   <tempNS:MyControl.Collection>
      <tempNS:MyCollection>
        <tempNS:MyCollectionItem …./>
        <tempNS:MyCollectionItem …./>
        <tempNS:MyCollectionItem …./>
      </tempNS:MyCollection>
  </tempNS:MyControl.MyCollection>
</tempNS:MyControl>

I was wondering why it happened and got my answer here . Basically, the framework used to initialize collections for you (if they weren’t already). But that turned out to be problematic, so they removed the functionality from the framework.

I fixed my problem by initializing the collection within the Control’s constructor. I guess that’s a growing pain of working with the latest and greatest. I wouldn’t have it any other way

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: