I'm building a custom control in Silverlight by deriving from ContentControl and doing some special formatting to put a dropshadow behind the contents.
I've nearly got it working but have recently ran into a bizarre error. It works fine if it contains anything besides a Border, or a Grid/Stackpanel/etc that does not have an explicitly defined height and width.
I get a JavaScript error in IE, and the text says:
Runtime Error 4008... Layout Cycle Detected... Layout Could Not Complete.
If I specify a height and width on the contained grid/stackpanel/etc it works fine.
There is a ton on the web about this error when too many textboxes are used (over 250), but I'm able to reproduce my error with a single button in a grid.
I have no textboxes at all on the page. The error has to do with a detected infinite loop. I set a few breakpoints in the code and it seems that the "SizeChanged" event is getting called a lot during rendering, and each time the height/width increments by 10.
I'm assuming that setting a default height/width causes it to skip this incrementing of the number, but I have no idea why this error is happening.
Has anyone ran into this or have any ideas?