I have a Silverlight control that outright quits rendering controls after a large number of nested child controls have been rendered. The main control is databound to an object similar in structure to the following:
MainViewModel
-> MatrixViewModel
-> List<SectionViewModel>
-> List<BuildingBlockViewModel>
The MainViewModel
has a child object property called MatrixViewModel
, which in turn has a list of SectionViewModel
s, and each SectionViewModel
has a list of BuildingBlockViewModel
s.
Each view model has a corresponding xaml view that contains a number of buttons, checkboxes, etc. And the SectionViewModel and BuildingBlockViewModel collections are rendered using standard ItemsControls within the xaml of their parent views.
I've found that if I remove a few of the xaml controls (buttons, stackpanels, etc) from the lowest level building block view then the control is able to render them all. However, as soon as I add the removed xaml back in it again ceases to load all of the controls.
It's as though Silverlight is bumping up against some sort of maximum object tree size or something. I've monitored memory and there is ample CPU memory left when the application loads so I'm not even close to pegging out the CPU.